From e06e0c8abcf337e51ba77fd30d0de984b67bbe77 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 31 Jan 2024 03:42:57 +0000 Subject: [PATCH] CodeGen from PR 3197 in test-repo-billy/azure-rest-api-specs Merge ae53571e91b8e256174afbed033c2772c35a634b into 19077176ed509f8139ce021aca5b14b1924a1fd9 --- .../azure-mgmt-applicationinsights/_meta.json | 29 +++++++-- ..._application_insights_management_client.py | 50 +++++++------- .../applicationinsights/_serialization.py | 30 ++++++--- ..._application_insights_management_client.py | 50 +++++++------- ..._application_insights_management_client.py | 48 +++++++++----- .../v2015_05_01/_vendor.py | 14 ---- .../v2015_05_01/_version.py | 2 +- ..._application_insights_management_client.py | 48 +++++++++----- .../operations/_analytics_items_operations.py | 12 ++-- .../aio/operations/_annotations_operations.py | 12 ++-- .../aio/operations/_api_keys_operations.py | 12 ++-- ...component_available_features_operations.py | 3 +- ...ent_current_billing_features_operations.py | 8 ++- ...mponent_feature_capabilities_operations.py | 3 +- .../_component_quota_status_operations.py | 3 +- .../aio/operations/_components_operations.py | 24 +++---- .../_export_configurations_operations.py | 16 +++-- .../aio/operations/_favorites_operations.py | 16 +++-- .../operations/_my_workbooks_operations.py | 18 ++--- .../v2015_05_01/aio/operations/_operations.py | 3 +- ...ive_detection_configurations_operations.py | 10 +-- .../_web_test_locations_operations.py | 3 +- .../aio/operations/_web_tests_operations.py | 20 +++--- .../_work_item_configurations_operations.py | 18 ++--- .../aio/operations/_workbooks_operations.py | 16 +++-- .../operations/_analytics_items_operations.py | 22 ++++--- .../operations/_annotations_operations.py | 22 ++++--- .../operations/_api_keys_operations.py | 22 ++++--- ...component_available_features_operations.py | 7 +- ...ent_current_billing_features_operations.py | 14 ++-- ...mponent_feature_capabilities_operations.py | 7 +- .../_component_quota_status_operations.py | 7 +- .../operations/_components_operations.py | 42 ++++++------ .../_export_configurations_operations.py | 28 ++++---- .../operations/_favorites_operations.py | 28 ++++---- .../operations/_my_workbooks_operations.py | 32 ++++----- .../v2015_05_01/operations/_operations.py | 3 +- ...ive_detection_configurations_operations.py | 18 ++--- .../_web_test_locations_operations.py | 7 +- .../operations/_web_tests_operations.py | 36 +++++----- .../_work_item_configurations_operations.py | 32 ++++----- .../operations/_workbooks_operations.py | 28 ++++---- ..._application_insights_management_client.py | 8 +-- .../v2017_10_01/_vendor.py | 14 ---- .../v2017_10_01/_version.py | 2 +- ..._application_insights_management_client.py | 8 +-- ...mponent_current_pricing_plan_operations.py | 12 ++-- ...cription_list_migration_date_operations.py | 3 +- ...migrate_to_new_pricing_model_operations.py | 3 +- ...back_to_legacy_pricing_model_operations.py | 3 +- ...mponent_current_pricing_plan_operations.py | 20 +++--- ...cription_list_migration_date_operations.py | 7 +- ...migrate_to_new_pricing_model_operations.py | 7 +- ...back_to_legacy_pricing_model_operations.py | 7 +- ..._application_insights_management_client.py | 14 ++-- .../v2018_05_01_preview/_vendor.py | 14 ---- .../v2018_05_01_preview/_version.py | 2 +- ..._application_insights_management_client.py | 14 ++-- .../aio/operations/_components_operations.py | 40 ++++++++---- .../aio/operations/_operations.py | 5 +- ...ive_detection_configurations_operations.py | 16 +++-- .../aio/operations/_web_tests_operations.py | 34 +++++++--- .../operations/_components_operations.py | 58 +++++++++++------ .../operations/_operations.py | 5 +- ...ive_detection_configurations_operations.py | 24 ++++--- .../operations/_web_tests_operations.py | 50 +++++++++----- ..._application_insights_management_client.py | 8 ++- .../v2018_06_17_preview/_vendor.py | 14 ---- .../v2018_06_17_preview/_version.py | 2 +- ..._application_insights_management_client.py | 8 ++- .../aio/operations/_operations.py | 5 +- .../aio/operations/_workbooks_operations.py | 26 ++++++-- .../operations/_operations.py | 5 +- .../operations/_workbooks_operations.py | 38 +++++++---- ..._application_insights_management_client.py | 2 +- .../v2019_10_17_preview/_vendor.py | 14 ---- .../v2019_10_17_preview/_version.py | 2 +- ..._application_insights_management_client.py | 2 +- .../_workbook_templates_operations.py | 26 ++++++-- .../_workbook_templates_operations.py | 38 +++++++---- ..._application_insights_management_client.py | 4 +- .../v2020_02_02/_vendor.py | 14 ---- .../v2020_02_02/_version.py | 2 +- ..._application_insights_management_client.py | 4 +- .../aio/operations/_components_operations.py | 24 +++---- .../operations/_components_operations.py | 42 ++++++------ ..._application_insights_management_client.py | 4 +- .../v2020_02_02_preview/_vendor.py | 14 ---- .../v2020_02_02_preview/_version.py | 2 +- ..._application_insights_management_client.py | 4 +- .../aio/operations/_components_operations.py | 40 ++++++++---- .../operations/_components_operations.py | 58 +++++++++++------ ..._application_insights_management_client.py | 2 +- .../v2020_03_01_preview/_vendor.py | 14 ---- .../v2020_03_01_preview/_version.py | 2 +- ..._application_insights_management_client.py | 2 +- ...nent_linked_storage_accounts_operations.py | 22 +++++-- ...nent_linked_storage_accounts_operations.py | 32 +++++---- ..._application_insights_management_client.py | 8 ++- .../v2020_06_02_preview/_vendor.py | 14 ---- .../v2020_06_02_preview/_version.py | 2 +- ..._application_insights_management_client.py | 8 ++- .../aio/operations/_live_token_operations.py | 5 +- .../aio/operations/_operations.py | 5 +- .../operations/_live_token_operations.py | 9 ++- .../operations/_operations.py | 5 +- ..._application_insights_management_client.py | 2 +- .../v2020_11_20/_vendor.py | 14 ---- .../v2020_11_20/_version.py | 2 +- ..._application_insights_management_client.py | 2 +- .../_workbook_templates_operations.py | 16 +++-- .../_workbook_templates_operations.py | 28 ++++---- ..._application_insights_management_client.py | 4 +- .../v2021_03_08/_vendor.py | 14 ---- .../v2021_03_08/_version.py | 2 +- ..._application_insights_management_client.py | 4 +- .../operations/_my_workbooks_operations.py | 18 ++--- .../operations/_my_workbooks_operations.py | 32 ++++----- ..._application_insights_management_client.py | 4 +- .../v2021_08_01/_vendor.py | 14 ---- .../v2021_08_01/_version.py | 2 +- ..._application_insights_management_client.py | 4 +- .../aio/operations/_workbooks_operations.py | 22 ++++--- .../operations/_workbooks_operations.py | 40 ++++++------ ..._application_insights_management_client.py | 4 +- .../applicationinsights/v2021_10/_vendor.py | 14 ---- .../applicationinsights/v2021_10/_version.py | 2 +- ..._application_insights_management_client.py | 4 +- .../aio/operations/_live_token_operations.py | 3 +- .../operations/_live_token_operations.py | 7 +- ..._application_insights_management_client.py | 4 +- .../v2022_04_01/_vendor.py | 14 ---- .../v2022_04_01/_version.py | 2 +- ..._application_insights_management_client.py | 4 +- .../aio/operations/_workbooks_operations.py | 22 ++++--- .../operations/_workbooks_operations.py | 40 ++++++------ ..._application_insights_management_client.py | 4 +- .../v2022_06_15/_vendor.py | 14 ---- .../v2022_06_15/_version.py | 2 +- ..._application_insights_management_client.py | 4 +- .../aio/operations/_web_tests_operations.py | 20 +++--- .../operations/_web_tests_operations.py | 36 +++++----- .../generated_samples/web_test_create.py | 59 +++++++++++++++++ .../web_test_create_standard.py | 65 +++++++++++++++++++ .../generated_samples/web_test_delete.py | 3 +- .../generated_samples/web_test_update.py | 56 ++++++++++++++++ .../web_test_update_tags_only.py | 49 ++++++++++++++ 147 files changed, 1411 insertions(+), 970 deletions(-) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_create.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_create_standard.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_update_tags_only.py diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/_meta.json b/sdk/applicationinsights/azure-mgmt-applicationinsights/_meta.json index 805f24b26fd04..68b5245cda70f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/_meta.json +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/_meta.json @@ -1,11 +1,26 @@ { - "commit": "e60df62e9e0d88462e6abba81a76d94eab000f0d", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "commit": "d60ce476b078d839d848c49248d2ed47ef9d06dc", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.8", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/applicationinsights/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", - "readme": "specification/applicationinsights/resource-manager/readme.md" + "autorest_command": "autorest specification/applicationinsights/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/applicationinsights/resource-manager/readme.md", + "package-2015-05": "2022-03-07 07:43:24 +0100 9735d8c1580e6b56e6d4508be6ec00f46e45cb77 Microsoft.Insights/stable/2015-05-01/webTests_API.json", + "package-2017-10": "2019-05-06 14:34:52 -0400 e129012901bbd9cc0f182ec5b539bccf2440ef4a Microsoft.Insights/preview/2017-10-01/eaSubscriptionMigration_API.json", + "package-2018-05-01-preview": "2021-08-24 22:48:16 -0700 e1eca381eca8ec1f80b722e5dbf060fdeef48653 Microsoft.Insights/preview/2018-05-01-preview/webTests_API.json", + "package-2018-06-17-preview": "2020-09-14 19:17:37 -0700 e354da005a6502cb3029853bd7360c69aeda80b6 Microsoft.Insights/preview/2018-06-17-preview/workbooks_API.json", + "package-2019-10-17-preview": "2020-07-27 18:31:44 -0700 ee068060cb90273a653e3964ffd9c69c6b2dc33b Microsoft.Insights/preview/2019-10-17-preview/workbookTemplates_API.json", + "package-2020-02-02-preview": "2021-05-11 01:54:13 +0300 497df1cf194392f38ce8b08405a6f887648d22fb Microsoft.Insights/preview/2020-02-02-preview/components_API.json", + "package-2020-02-02-only": "2022-07-01 09:55:24 +0300 1ddabd9234338d209f9755beac5c13cc0ae3b5f7 Microsoft.Insights/stable/2020-02-02/components_API.json", + "package-2020-03-01-preview": "2021-06-30 08:40:16 +0300 4483c52219e9e8490dabbe53f1fe8005e8f3acd3 Microsoft.Insights/preview/2020-03-01-preview/componentLinkedStorageAccounts_API.json", + "package-preview-2020-06-only": "2021-06-30 08:40:16 +0300 4483c52219e9e8490dabbe53f1fe8005e8f3acd3 Microsoft.Insights/preview/2020-06-02-preview/livetoken_API.json", + "package-2020-11-only": "2022-03-07 07:43:24 +0100 9735d8c1580e6b56e6d4508be6ec00f46e45cb77 Microsoft.Insights/stable/2020-11-20/workbookTemplates_API.json", + "package-2021-03-08-only": "2021-05-05 20:47:33 -0700 6967cbe61d5d5fd18412343bcde770f3257c05b5 Microsoft.Insights/stable/2021-03-08/myworkbooks_API.json", + "package-2021-08": "2023-01-25 22:33:01 -0800 6e290d0b310e87d56cfa98cababea00b489d2c07 Microsoft.Insights/stable/2021-08-01/workbooks_API.json", + "package-2021-10": "2022-03-07 07:43:24 +0100 9735d8c1580e6b56e6d4508be6ec00f46e45cb77 Microsoft.Insights/stable/2021-10-14/livetoken_API.json", + "package-2022-04-01-only": "2023-01-25 22:33:01 -0800 6e290d0b310e87d56cfa98cababea00b489d2c07 Microsoft.Insights/stable/2022-04-01/workbooks_API.json", + "package-2022-06-15-only": "2023-01-19 08:29:19 +0530 13d172c85dac78b65d023dcd95097c383e38c048 Microsoft.Insights/stable/2022-06-15/webTests_API.json" } \ No newline at end of file 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/_application_insights_management_client.py index eae2afe782e1e..765b9c1302e2a 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_application_insights_management_client.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_application_insights_management_client.py @@ -93,6 +93,8 @@ def __init__( profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): + if api_version: + kwargs.setdefault('api_version', api_version) self._config = ApplicationInsightsManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(ApplicationInsightsManagementClient, self).__init__( @@ -183,7 +185,7 @@ def analytics_items(self): else: raise ValueError("API version {} does not have operation group 'analytics_items'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def annotations(self): @@ -197,7 +199,7 @@ def annotations(self): else: raise ValueError("API version {} does not have operation group 'annotations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def api_keys(self): @@ -211,7 +213,7 @@ def api_keys(self): else: raise ValueError("API version {} does not have operation group 'api_keys'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_available_features(self): @@ -225,7 +227,7 @@ def component_available_features(self): else: raise ValueError("API version {} does not have operation group 'component_available_features'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_current_billing_features(self): @@ -239,7 +241,7 @@ def component_current_billing_features(self): else: raise ValueError("API version {} does not have operation group 'component_current_billing_features'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_current_pricing_plan(self): @@ -253,7 +255,7 @@ def component_current_pricing_plan(self): else: raise ValueError("API version {} does not have operation group 'component_current_pricing_plan'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_feature_capabilities(self): @@ -267,7 +269,7 @@ def component_feature_capabilities(self): else: raise ValueError("API version {} does not have operation group 'component_feature_capabilities'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_linked_storage_accounts(self): @@ -281,7 +283,7 @@ def component_linked_storage_accounts(self): else: raise ValueError("API version {} does not have operation group 'component_linked_storage_accounts'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_quota_status(self): @@ -295,7 +297,7 @@ def component_quota_status(self): else: raise ValueError("API version {} does not have operation group 'component_quota_status'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def components(self): @@ -318,7 +320,7 @@ def components(self): else: raise ValueError("API version {} does not have operation group 'components'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def ea_subscription_list_migration_date(self): @@ -332,7 +334,7 @@ def ea_subscription_list_migration_date(self): else: raise ValueError("API version {} does not have operation group 'ea_subscription_list_migration_date'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def ea_subscription_migrate_to_new_pricing_model(self): @@ -346,7 +348,7 @@ def ea_subscription_migrate_to_new_pricing_model(self): else: raise ValueError("API version {} does not have operation group 'ea_subscription_migrate_to_new_pricing_model'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def ea_subscription_rollback_to_legacy_pricing_model(self): @@ -360,7 +362,7 @@ def ea_subscription_rollback_to_legacy_pricing_model(self): else: raise ValueError("API version {} does not have operation group 'ea_subscription_rollback_to_legacy_pricing_model'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def export_configurations(self): @@ -374,7 +376,7 @@ def export_configurations(self): else: raise ValueError("API version {} does not have operation group 'export_configurations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def favorites(self): @@ -388,7 +390,7 @@ def favorites(self): else: raise ValueError("API version {} does not have operation group 'favorites'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def live_token(self): @@ -405,7 +407,7 @@ def live_token(self): else: raise ValueError("API version {} does not have operation group 'live_token'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def my_workbooks(self): @@ -422,7 +424,7 @@ def my_workbooks(self): else: raise ValueError("API version {} does not have operation group 'my_workbooks'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -445,7 +447,7 @@ def operations(self): else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def proactive_detection_configurations(self): @@ -462,7 +464,7 @@ def proactive_detection_configurations(self): else: raise ValueError("API version {} does not have operation group 'proactive_detection_configurations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def web_test_locations(self): @@ -476,7 +478,7 @@ def web_test_locations(self): else: raise ValueError("API version {} does not have operation group 'web_test_locations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def web_tests(self): @@ -496,7 +498,7 @@ def web_tests(self): else: raise ValueError("API version {} does not have operation group 'web_tests'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def work_item_configurations(self): @@ -510,7 +512,7 @@ def work_item_configurations(self): else: raise ValueError("API version {} does not have operation group 'work_item_configurations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def workbook_templates(self): @@ -527,7 +529,7 @@ def workbook_templates(self): else: raise ValueError("API version {} does not have operation group 'workbook_templates'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def workbooks(self): @@ -550,7 +552,7 @@ def workbooks(self): else: raise ValueError("API version {} does not have operation group 'workbooks'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) def close(self): self._client.close() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_serialization.py index e3cc6ce6ed6f8..a00658b1fc190 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_serialization.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_serialization.py @@ -664,8 +664,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + 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)) @@ -743,6 +744,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -751,10 +754,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get('skip_quote', False) + return str(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) @@ -893,6 +894,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -905,9 +908,18 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + 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) @@ -952,7 +964,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: 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/aio/_application_insights_management_client.py index ce030d0c5d7b0..a9d322ad72d2b 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/aio/_application_insights_management_client.py @@ -93,6 +93,8 @@ def __init__( profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: + if api_version: + kwargs.setdefault('api_version', api_version) self._config = ApplicationInsightsManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(ApplicationInsightsManagementClient, self).__init__( @@ -183,7 +185,7 @@ def analytics_items(self): else: raise ValueError("API version {} does not have operation group 'analytics_items'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def annotations(self): @@ -197,7 +199,7 @@ def annotations(self): else: raise ValueError("API version {} does not have operation group 'annotations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def api_keys(self): @@ -211,7 +213,7 @@ def api_keys(self): else: raise ValueError("API version {} does not have operation group 'api_keys'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_available_features(self): @@ -225,7 +227,7 @@ def component_available_features(self): else: raise ValueError("API version {} does not have operation group 'component_available_features'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_current_billing_features(self): @@ -239,7 +241,7 @@ def component_current_billing_features(self): else: raise ValueError("API version {} does not have operation group 'component_current_billing_features'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_current_pricing_plan(self): @@ -253,7 +255,7 @@ def component_current_pricing_plan(self): else: raise ValueError("API version {} does not have operation group 'component_current_pricing_plan'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_feature_capabilities(self): @@ -267,7 +269,7 @@ def component_feature_capabilities(self): else: raise ValueError("API version {} does not have operation group 'component_feature_capabilities'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_linked_storage_accounts(self): @@ -281,7 +283,7 @@ def component_linked_storage_accounts(self): else: raise ValueError("API version {} does not have operation group 'component_linked_storage_accounts'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def component_quota_status(self): @@ -295,7 +297,7 @@ def component_quota_status(self): else: raise ValueError("API version {} does not have operation group 'component_quota_status'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def components(self): @@ -318,7 +320,7 @@ def components(self): else: raise ValueError("API version {} does not have operation group 'components'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def ea_subscription_list_migration_date(self): @@ -332,7 +334,7 @@ def ea_subscription_list_migration_date(self): else: raise ValueError("API version {} does not have operation group 'ea_subscription_list_migration_date'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def ea_subscription_migrate_to_new_pricing_model(self): @@ -346,7 +348,7 @@ def ea_subscription_migrate_to_new_pricing_model(self): else: raise ValueError("API version {} does not have operation group 'ea_subscription_migrate_to_new_pricing_model'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def ea_subscription_rollback_to_legacy_pricing_model(self): @@ -360,7 +362,7 @@ def ea_subscription_rollback_to_legacy_pricing_model(self): else: raise ValueError("API version {} does not have operation group 'ea_subscription_rollback_to_legacy_pricing_model'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def export_configurations(self): @@ -374,7 +376,7 @@ def export_configurations(self): else: raise ValueError("API version {} does not have operation group 'export_configurations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def favorites(self): @@ -388,7 +390,7 @@ def favorites(self): else: raise ValueError("API version {} does not have operation group 'favorites'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def live_token(self): @@ -405,7 +407,7 @@ def live_token(self): else: raise ValueError("API version {} does not have operation group 'live_token'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def my_workbooks(self): @@ -422,7 +424,7 @@ def my_workbooks(self): else: raise ValueError("API version {} does not have operation group 'my_workbooks'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -445,7 +447,7 @@ def operations(self): else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def proactive_detection_configurations(self): @@ -462,7 +464,7 @@ def proactive_detection_configurations(self): else: raise ValueError("API version {} does not have operation group 'proactive_detection_configurations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def web_test_locations(self): @@ -476,7 +478,7 @@ def web_test_locations(self): else: raise ValueError("API version {} does not have operation group 'web_test_locations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def web_tests(self): @@ -496,7 +498,7 @@ def web_tests(self): else: raise ValueError("API version {} does not have operation group 'web_tests'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def work_item_configurations(self): @@ -510,7 +512,7 @@ def work_item_configurations(self): else: raise ValueError("API version {} does not have operation group 'work_item_configurations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def workbook_templates(self): @@ -527,7 +529,7 @@ def workbook_templates(self): else: raise ValueError("API version {} does not have operation group 'workbook_templates'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def workbooks(self): @@ -550,7 +552,7 @@ def workbooks(self): else: raise ValueError("API version {} does not have operation group 'workbooks'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) async def close(self): await self._client.close() 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/v2015_05_01/_application_insights_management_client.py index 11708e3b2a5f7..aeb78c36f429d 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/v2015_05_01/_application_insights_management_client.py @@ -115,39 +115,53 @@ def __init__( 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.annotations = AnnotationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_keys = APIKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2015-05-01") + self.annotations = AnnotationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.api_keys = APIKeysOperations(self._client, self._config, self._serialize, self._deserialize, "2015-05-01") self.export_configurations = ExportConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.component_current_billing_features = ComponentCurrentBillingFeaturesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.component_quota_status = ComponentQuotaStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.component_feature_capabilities = ComponentFeatureCapabilitiesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.component_available_features = ComponentAvailableFeaturesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.components = ComponentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) - 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._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.favorites = FavoritesOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) - self.favorites = FavoritesOperations(self._client, self._config, self._serialize, self._deserialize) self.web_test_locations = WebTestLocationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.web_tests = WebTestsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.analytics_items = AnalyticsItemsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.workbooks = WorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.my_workbooks = MyWorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) - 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, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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/v2015_05_01/aio/_application_insights_management_client.py index f02ef1550bc00..1c46ce412e192 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/v2015_05_01/aio/_application_insights_management_client.py @@ -119,39 +119,53 @@ def __init__( 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.annotations = AnnotationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_keys = APIKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2015-05-01") + self.annotations = AnnotationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.api_keys = APIKeysOperations(self._client, self._config, self._serialize, self._deserialize, "2015-05-01") self.export_configurations = ExportConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.component_current_billing_features = ComponentCurrentBillingFeaturesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.component_quota_status = ComponentQuotaStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.component_feature_capabilities = ComponentFeatureCapabilitiesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.component_available_features = ComponentAvailableFeaturesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) self.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.components = ComponentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) - 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._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.favorites = FavoritesOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) - self.favorites = FavoritesOperations(self._client, self._config, self._serialize, self._deserialize) self.web_test_locations = WebTestLocationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.web_tests = WebTestsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.analytics_items = AnalyticsItemsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.workbooks = WorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" + ) + self.my_workbooks = MyWorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-05-01" ) - 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, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index ea1442a77aa0d..f9e5a1e4141c5 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -54,6 +55,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list( @@ -104,7 +106,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._api_version or "2015-05-01")) cls: ClsType[List[_models.ApplicationInsightsComponentAnalyticsItem]] = kwargs.pop("cls", None) request = build_list_request( @@ -189,7 +191,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) request = build_get_request( @@ -358,14 +360,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(item_properties, (IO, bytes)): + if isinstance(item_properties, (IOBase, bytes)): _content = item_properties else: _json = self._serialize.body(item_properties, "ApplicationInsightsComponentAnalyticsItem") @@ -452,7 +454,7 @@ async 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._api_version or "2015-05-01")) 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/_annotations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_annotations_operations.py index 3ac157beab4b5..ce981a97dc0c7 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload import urllib.parse @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -83,7 +85,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._api_version or "2015-05-01")) cls: ClsType[_models.AnnotationsListResult] = kwargs.pop("cls", None) error_map = { @@ -254,14 +256,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(annotation_properties, (IO, bytes)): + if isinstance(annotation_properties, (IOBase, bytes)): _content = annotation_properties else: _json = self._serialize.body(annotation_properties, "Annotation") @@ -334,7 +336,7 @@ async 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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -398,7 +400,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._api_version or "2015-05-01")) cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) request = build_get_request( 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 index 2c416c9392045..e2039855a997a 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -79,7 +81,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAPIKeyListResult] = kwargs.pop("cls", None) error_map = { @@ -247,14 +249,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(api_key_properties, (IO, bytes)): + if isinstance(api_key_properties, (IOBase, bytes)): _content = api_key_properties else: _json = self._serialize.body(api_key_properties, "APIKeyRequest") @@ -326,7 +328,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) request = build_delete_request( @@ -394,7 +396,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) request = build_get_request( 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 index 8d94d43f51e8a..e0c2da87d3325 100644 --- 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -78,7 +79,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAvailableFeatures] = kwargs.pop("cls", None) request = build_get_request( 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 index 3c063ee42e457..1584651df47ee 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -49,6 +50,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -78,7 +80,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) request = build_get_request( @@ -217,14 +219,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(billing_features_properties, (IO, bytes)): + if isinstance(billing_features_properties, (IOBase, bytes)): _content = billing_features_properties else: _json = self._serialize.body(billing_features_properties, "ApplicationInsightsComponentBillingFeatures") 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 index 56fbfa33e8956..8d347fb2c769b 100644 --- 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -78,7 +79,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentFeatureCapabilities] = kwargs.pop("cls", None) request = build_get_request( 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 index 92a49f5960c4c..77cafe0ca56ce 100644 --- 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -78,7 +79,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._api_version or "2015-05-01")) 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/aio/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_components_operations.py index 0dc841745dd0f..cf90b9624c4e3 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -61,6 +62,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationInsightsComponent"]: @@ -76,7 +78,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationInsightsCompo _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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -163,7 +165,7 @@ def list_by_resource_group( _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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -261,7 +263,7 @@ async 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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -321,7 +323,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) request = build_get_request( @@ -458,14 +460,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(insight_properties, (IOBase, bytes)): _content = insight_properties else: _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") @@ -600,14 +602,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(component_tags, (IOBase, bytes)): _content = component_tags else: _json = self._serialize.body(component_tags, "TagsResource") @@ -758,14 +760,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ComponentPurgeBody") @@ -837,7 +839,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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) request = build_get_purge_status_request( 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 index 6fd2554971101..8c7c9c1d50f6f 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -55,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list( @@ -84,7 +86,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._api_version or "2015-05-01")) cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) request = build_list_request( @@ -223,14 +225,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(export_properties, (IO, bytes)): + if isinstance(export_properties, (IOBase, bytes)): _content = export_properties else: _json = self._serialize.body(export_properties, "ApplicationInsightsComponentExportRequest") @@ -303,7 +305,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) request = build_delete_request( @@ -372,7 +374,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -524,14 +526,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(export_properties, (IO, bytes)): + if isinstance(export_properties, (IOBase, bytes)): _content = export_properties else: _json = self._serialize.body(export_properties, "ApplicationInsightsComponentExportRequest") 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 index 3391029fb79a3..6045e326ba517 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -55,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list( @@ -104,7 +106,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._api_version or "2015-05-01")) cls: ClsType[List[_models.ApplicationInsightsComponentFavorite]] = kwargs.pop("cls", None) request = build_list_request( @@ -175,7 +177,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) request = build_get_request( @@ -323,14 +325,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(favorite_properties, (IO, bytes)): + if isinstance(favorite_properties, (IOBase, bytes)): _content = favorite_properties else: _json = self._serialize.body(favorite_properties, "ApplicationInsightsComponentFavorite") @@ -482,14 +484,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(favorite_properties, (IO, bytes)): + if isinstance(favorite_properties, (IOBase, bytes)): _content = favorite_properties else: _json = self._serialize.body(favorite_properties, "ApplicationInsightsComponentFavorite") @@ -562,7 +564,7 @@ async 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._api_version or "2015-05-01")) 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 index 67c1fd59e11f4..cc2bfcd968225 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -92,7 +94,7 @@ def list_by_resource_group( _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._api_version or "2015-05-01")) cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -195,7 +197,7 @@ def list_by_subscription( _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._api_version or "2015-05-01")) cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -292,7 +294,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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) request = build_get_request( @@ -357,7 +359,7 @@ async 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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -486,14 +488,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "MyWorkbook") @@ -635,14 +637,14 @@ 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._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "MyWorkbook") 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 index 2ea7ada16b835..c606295cdee3a 100644 --- 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 @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _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._api_version or "2015-05-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 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 index e503e55868fe8..396a10ecc827a 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -53,6 +54,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list( @@ -83,7 +85,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._api_version or "2015-05-01")) cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( "cls", None ) @@ -156,7 +158,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -313,14 +315,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(proactive_detection_properties, (IO, bytes)): + if isinstance(proactive_detection_properties, (IOBase, bytes)): _content = proactive_detection_properties else: _json = self._serialize.body( 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 index a3025fca520cb..54d3752f0cff1 100644 --- 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 @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -73,7 +74,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsWebTestLocationsListResult] = kwargs.pop("cls", None) error_map = { 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 index 102f76ab028e8..64d2441fa2cb3 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.WebTest"]: @@ -77,7 +79,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2015-05-01")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -173,7 +175,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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) request = build_get_request( @@ -305,14 +307,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(web_test_definition, (IOBase, bytes)): _content = web_test_definition else: _json = self._serialize.body(web_test_definition, "WebTest") @@ -447,14 +449,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(web_test_tags, (IOBase, bytes)): _content = web_test_tags else: _json = self._serialize.body(web_test_tags, "TagsResource") @@ -523,7 +525,7 @@ async 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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -569,7 +571,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.WebTest"]: _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._api_version or "2015-05-01")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -657,7 +659,7 @@ def list_by_component( _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._api_version or "2015-05-01")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { 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 index 502381a7c72f2..dc210790ad4ab 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -81,7 +83,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._api_version or "2015-05-01")) cls: ClsType[_models.WorkItemConfigurationsListResult] = kwargs.pop("cls", None) error_map = { @@ -252,14 +254,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(work_item_configuration_properties, (IO, bytes)): + if isinstance(work_item_configuration_properties, (IOBase, bytes)): _content = work_item_configuration_properties else: _json = self._serialize.body(work_item_configuration_properties, "WorkItemCreateConfiguration") @@ -328,7 +330,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._api_version or "2015-05-01")) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) request = build_get_default_request( @@ -395,7 +397,7 @@ async 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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -459,7 +461,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._api_version or "2015-05-01")) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) request = build_get_item_request( @@ -607,14 +609,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(work_item_configuration_properties, (IO, bytes)): + if isinstance(work_item_configuration_properties, (IOBase, bytes)): _content = work_item_configuration_properties else: _json = self._serialize.body(work_item_configuration_properties, "WorkItemCreateConfiguration") 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 index 62379f3353d19..42558628eda87 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload import urllib.parse @@ -58,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -91,7 +93,7 @@ def list_by_resource_group( _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._api_version or "2015-05-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -191,7 +193,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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_get_request( @@ -256,7 +258,7 @@ async 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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -385,14 +387,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-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" _json = None _content = None - if isinstance(workbook_properties, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") @@ -534,14 +536,14 @@ 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._api_version or "2015-05-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" _json = None _content = None - if isinstance(workbook_properties, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") 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 index f69123d9a2df2..39726ba7769db 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +66,7 @@ def build_list_request( "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,7 +113,7 @@ def build_get_request( "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +158,7 @@ def build_put_request( "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,7 +200,7 @@ def build_delete_request( "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,6 +230,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -279,7 +281,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._api_version or "2015-05-01")) cls: ClsType[List[_models.ApplicationInsightsComponentAnalyticsItem]] = kwargs.pop("cls", None) request = build_list_request( @@ -364,7 +366,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) request = build_get_request( @@ -533,14 +535,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(item_properties, (IO, bytes)): + if isinstance(item_properties, (IOBase, bytes)): _content = item_properties else: _json = self._serialize.body(item_properties, "ApplicationInsightsComponentAnalyticsItem") @@ -627,7 +629,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._api_version or "2015-05-01")) 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/_annotations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_annotations_operations.py index 23208a656674f..8676c359996ed 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +59,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,7 +95,7 @@ def build_create_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,7 +128,7 @@ def build_delete_request( "annotationId": _SERIALIZER.url("annotation_id", annotation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,7 +159,7 @@ def build_get_request( "annotationId": _SERIALIZER.url("annotation_id", annotation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,6 +188,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -213,7 +215,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._api_version or "2015-05-01")) cls: ClsType[_models.AnnotationsListResult] = kwargs.pop("cls", None) error_map = { @@ -384,14 +386,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(annotation_properties, (IO, bytes)): + if isinstance(annotation_properties, (IOBase, bytes)): _content = annotation_properties else: _json = self._serialize.body(annotation_properties, "Annotation") @@ -464,7 +466,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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -528,7 +530,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._api_version or "2015-05-01")) cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) request = build_get_request( 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 index 2a264f1c851e0..36be50c96d9dd 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +59,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,7 +93,7 @@ def build_create_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +129,7 @@ def build_delete_request( "keyId": _SERIALIZER.url("key_id", key_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +163,7 @@ def build_get_request( "keyId": _SERIALIZER.url("key_id", key_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,6 +192,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -213,7 +215,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAPIKeyListResult] = kwargs.pop("cls", None) error_map = { @@ -381,14 +383,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(api_key_properties, (IO, bytes)): + if isinstance(api_key_properties, (IOBase, bytes)): _content = api_key_properties else: _json = self._serialize.body(api_key_properties, "APIKeyRequest") @@ -460,7 +462,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) request = build_delete_request( @@ -528,7 +530,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) request = build_get_request( 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 index e644efd147806..f79238659bc9f 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,6 +83,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -112,7 +113,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentAvailableFeatures] = kwargs.pop("cls", None) request = build_get_request( 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 index 8ba9714361407..636d64c91c368 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +55,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +89,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,6 +120,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -148,7 +150,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) request = build_get_request( @@ -287,14 +289,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(billing_features_properties, (IO, bytes)): + if isinstance(billing_features_properties, (IOBase, bytes)): _content = billing_features_properties else: _json = self._serialize.body(billing_features_properties, "ApplicationInsightsComponentBillingFeatures") 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 index c55de72491f9b..5b475e5371382 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,6 +83,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -112,7 +113,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentFeatureCapabilities] = kwargs.pop("cls", None) request = build_get_request( 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 index 561a7d010fd50..d8e39e33b13e8 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,6 +83,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -112,7 +113,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._api_version or "2015-05-01")) 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 index ae16c9c7d3ab8..09bae24a9c171 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +80,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +110,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +138,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +172,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,7 +208,7 @@ def build_update_tags_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -243,7 +244,7 @@ def build_purge_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -279,7 +280,7 @@ def build_get_purge_status_request( "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -308,6 +309,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ApplicationInsightsComponent"]: @@ -323,7 +325,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApplicationInsightsComponent" _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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -410,7 +412,7 @@ def list_by_resource_group( _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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -508,7 +510,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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -566,7 +568,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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) request = build_get_request( @@ -703,14 +705,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(insight_properties, (IOBase, bytes)): _content = insight_properties else: _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") @@ -845,14 +847,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(component_tags, (IOBase, bytes)): _content = component_tags else: _json = self._serialize.body(component_tags, "TagsResource") @@ -1003,14 +1005,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ComponentPurgeBody") @@ -1082,7 +1084,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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) request = build_get_purge_status_request( 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 index 9155e7aa5078e..d8250812204d3 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +57,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +91,7 @@ def build_create_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +127,7 @@ def build_delete_request( "exportId": _SERIALIZER.url("export_id", export_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +161,7 @@ def build_get_request( "exportId": _SERIALIZER.url("export_id", export_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +196,7 @@ def build_update_request( "exportId": _SERIALIZER.url("export_id", export_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,6 +227,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -255,7 +257,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._api_version or "2015-05-01")) cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) request = build_list_request( @@ -394,14 +396,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(export_properties, (IO, bytes)): + if isinstance(export_properties, (IOBase, bytes)): _content = export_properties else: _json = self._serialize.body(export_properties, "ApplicationInsightsComponentExportRequest") @@ -474,7 +476,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) request = build_delete_request( @@ -543,7 +545,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -695,14 +697,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(export_properties, (IO, bytes)): + if isinstance(export_properties, (IOBase, bytes)): _content = export_properties else: _json = self._serialize.body(export_properties, "ApplicationInsightsComponentExportRequest") 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 index ec7d4b6c382ba..febd25213b90a 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +65,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,7 +107,7 @@ def build_get_request( "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -141,7 +142,7 @@ def build_add_request( "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -178,7 +179,7 @@ def build_update_request( "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -211,7 +212,7 @@ def build_delete_request( "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,6 +238,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -286,7 +288,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._api_version or "2015-05-01")) cls: ClsType[List[_models.ApplicationInsightsComponentFavorite]] = kwargs.pop("cls", None) request = build_list_request( @@ -357,7 +359,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) request = build_get_request( @@ -505,14 +507,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(favorite_properties, (IO, bytes)): + if isinstance(favorite_properties, (IOBase, bytes)): _content = favorite_properties else: _json = self._serialize.body(favorite_properties, "ApplicationInsightsComponentFavorite") @@ -664,14 +666,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(favorite_properties, (IO, bytes)): + if isinstance(favorite_properties, (IOBase, bytes)): _content = favorite_properties else: _json = self._serialize.body(favorite_properties, "ApplicationInsightsComponentFavorite") @@ -744,7 +746,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._api_version or "2015-05-01")) 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 index c217c918ffd91..b1c6265a63fee 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +64,7 @@ def build_list_by_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -99,7 +100,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -135,7 +136,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,7 +169,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +203,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -238,7 +239,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,6 +270,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -302,7 +304,7 @@ def list_by_resource_group( _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._api_version or "2015-05-01")) cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -405,7 +407,7 @@ def list_by_subscription( _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._api_version or "2015-05-01")) cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -502,7 +504,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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) request = build_get_request( @@ -567,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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -696,14 +698,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "MyWorkbook") @@ -845,14 +847,14 @@ 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._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "MyWorkbook") 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 index 0e0804ca28b4d..31276cc68870a 100644 --- 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 @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -87,7 +88,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _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._api_version or "2015-05-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 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 index 8ddb3a96892c3..6fd86a45eaa07 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +57,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +91,7 @@ def build_get_request( "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,7 +126,7 @@ def build_update_request( "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,6 +157,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -186,7 +188,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._api_version or "2015-05-01")) cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( "cls", None ) @@ -259,7 +261,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -416,14 +418,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(proactive_detection_properties, (IO, bytes)): + if isinstance(proactive_detection_properties, (IOBase, bytes)): _content = proactive_detection_properties else: _json = self._serialize.body( 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 index 0e5cd7a9e71e9..c7e6deba5c30f 100644 --- 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +58,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,6 +87,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -109,7 +110,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._api_version or "2015-05-01")) cls: ClsType[_models.ApplicationInsightsWebTestLocationsListResult] = kwargs.pop("cls", None) error_map = { 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 index 5a5d38328f67d..a8edc5c2d02c4 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +56,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +87,7 @@ def build_get_request(resource_group_name: str, web_test_name: str, subscription "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +121,7 @@ def build_create_or_update_request( "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,7 +157,7 @@ def build_update_tags_request( "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +189,7 @@ def build_delete_request( "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +210,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +243,7 @@ def build_list_by_component_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -271,6 +272,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.WebTest"]: @@ -288,7 +290,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2015-05-01")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -384,7 +386,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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) request = build_get_request( @@ -516,14 +518,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(web_test_definition, (IOBase, bytes)): _content = web_test_definition else: _json = self._serialize.body(web_test_definition, "WebTest") @@ -658,14 +660,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) 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, (IO, bytes)): + if isinstance(web_test_tags, (IOBase, bytes)): _content = web_test_tags else: _json = self._serialize.body(web_test_tags, "TagsResource") @@ -734,7 +736,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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -780,7 +782,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.WebTest"]: _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._api_version or "2015-05-01")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -868,7 +870,7 @@ def list_by_component( _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._api_version or "2015-05-01")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { 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 index 490330e25c7d5..76188266f3c43 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +59,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,7 +93,7 @@ def build_create_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,7 +128,7 @@ def build_get_default_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,7 +159,7 @@ def build_delete_request( "workItemConfigId": _SERIALIZER.url("work_item_config_id", work_item_config_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,7 +190,7 @@ def build_get_item_request( "workItemConfigId": _SERIALIZER.url("work_item_config_id", work_item_config_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -224,7 +225,7 @@ def build_update_item_request( "workItemConfigId": _SERIALIZER.url("work_item_config_id", work_item_config_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -255,6 +256,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -277,7 +279,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._api_version or "2015-05-01")) cls: ClsType[_models.WorkItemConfigurationsListResult] = kwargs.pop("cls", None) error_map = { @@ -448,14 +450,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(work_item_configuration_properties, (IO, bytes)): + if isinstance(work_item_configuration_properties, (IOBase, bytes)): _content = work_item_configuration_properties else: _json = self._serialize.body(work_item_configuration_properties, "WorkItemCreateConfiguration") @@ -522,7 +524,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._api_version or "2015-05-01")) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) request = build_get_default_request( @@ -589,7 +591,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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -653,7 +655,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._api_version or "2015-05-01")) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) request = build_get_item_request( @@ -801,14 +803,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(work_item_configuration_properties, (IO, bytes)): + if isinstance(work_item_configuration_properties, (IOBase, bytes)): _content = work_item_configuration_properties else: _json = self._serialize.body(work_item_configuration_properties, "WorkItemCreateConfiguration") 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 index ac0bec72c2e0a..5bd143dd71e7a 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +64,7 @@ def build_list_by_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -99,7 +100,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,7 +133,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,7 +167,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +203,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,6 +234,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -266,7 +268,7 @@ def list_by_resource_group( _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._api_version or "2015-05-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -366,7 +368,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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_get_request( @@ -431,7 +433,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._api_version or "2015-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -560,14 +562,14 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-05-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" _json = None _content = None - if isinstance(workbook_properties, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") @@ -709,14 +711,14 @@ 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._api_version or "2015-05-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" _json = None _content = None - if isinstance(workbook_properties, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") 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 index 8a0b3a94bbf9d..227e94cc963ee 100644 --- 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 @@ -72,16 +72,16 @@ def __init__( 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._client, self._config, self._serialize, self._deserialize, "2017-10-01" ) self.ea_subscription_rollback_to_legacy_pricing_model = EASubscriptionRollbackToLegacyPricingModelOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-10-01" ) self.ea_subscription_list_migration_date = EASubscriptionListMigrationDateOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-10-01" ) self.component_current_pricing_plan = ComponentCurrentPricingPlanOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-10-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 4ad50ab3d067a..5a38be08ab421 100644 --- 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 @@ -72,16 +72,16 @@ def __init__( 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._client, self._config, self._serialize, self._deserialize, "2017-10-01" ) self.ea_subscription_rollback_to_legacy_pricing_model = EASubscriptionRollbackToLegacyPricingModelOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-10-01" ) self.ea_subscription_list_migration_date = EASubscriptionListMigrationDateOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-10-01" ) self.component_current_pricing_plan = ComponentCurrentPricingPlanOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-10-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 index 91f07495688a0..4aeaebe0456a2 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -53,6 +54,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -82,7 +84,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", "2017-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) request = build_get_request( @@ -221,14 +223,14 @@ 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", "2017-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) 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, (IO, bytes)): + if isinstance(pricing_plan_properties, (IOBase, bytes)): _content = pricing_plan_properties else: _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") @@ -372,14 +374,14 @@ 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", "2017-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) 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, (IO, bytes)): + if isinstance(pricing_plan_properties, (IOBase, bytes)): _content = pricing_plan_properties else: _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") 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 index 9f497a53edea6..0950d26c2285d 100644 --- 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def post(self, **kwargs: Any) -> _models.EASubscriptionMigrationDate: @@ -70,7 +71,7 @@ async def post(self, **kwargs: Any) -> _models.EASubscriptionMigrationDate: _headers = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.EASubscriptionMigrationDate] = kwargs.pop("cls", None) request = build_post_request( 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 index cd95ad9160913..dd3ee69351c73 100644 --- 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -70,7 +71,7 @@ async def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret _headers = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_post_request( 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 index a82a631660726..4640953295154 100644 --- 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -70,7 +71,7 @@ async def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret _headers = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_post_request( 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 index 4d615530170b2..58d3ddadf86d1 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +55,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +89,7 @@ def build_create_and_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +125,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,6 +156,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -184,7 +186,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", "2017-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) request = build_get_request( @@ -323,14 +325,14 @@ 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", "2017-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) 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, (IO, bytes)): + if isinstance(pricing_plan_properties, (IOBase, bytes)): _content = pricing_plan_properties else: _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") @@ -474,14 +476,14 @@ 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", "2017-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) 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, (IO, bytes)): + if isinstance(pricing_plan_properties, (IOBase, bytes)): _content = pricing_plan_properties else: _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") 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 index 1b06d649fc019..c32c7717bfabb 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +47,7 @@ def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,6 +76,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def post(self, **kwargs: Any) -> _models.EASubscriptionMigrationDate: @@ -97,7 +98,7 @@ def post(self, **kwargs: Any) -> _models.EASubscriptionMigrationDate: _headers = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.EASubscriptionMigrationDate] = kwargs.pop("cls", None) request = build_post_request( 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 index ffcdcbdfa554b..e4332b100c7b7 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,6 +78,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -99,7 +100,7 @@ def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_post_request( 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 index e922798dbb77b..3f8739300cfb3 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,6 +78,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -99,7 +100,7 @@ def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_post_request( 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 index 7567757964356..d7d64af768b5e 100644 --- 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 @@ -64,11 +64,17 @@ def __init__( 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._client, self._config, self._serialize, self._deserialize, "2018-05-01-preview" + ) + self.components = ComponentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2018-05-01-preview" + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2018-05-01-preview" + ) + self.web_tests = WebTestsOperations( + self._client, self._config, self._serialize, self._deserialize, "2018-05-01-preview" ) - 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, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 1158800060c90..74d058e466955 100644 --- 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 @@ -65,11 +65,17 @@ def __init__( 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._client, self._config, self._serialize, self._deserialize, "2018-05-01-preview" + ) + self.components = ComponentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2018-05-01-preview" + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2018-05-01-preview" + ) + self.web_tests = WebTestsOperations( + self._client, self._config, self._serialize, self._deserialize, "2018-05-01-preview" ) - 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, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index f2d5c16d221f0..b6fd37e6027dc 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -61,6 +62,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationInsightsComponent"]: @@ -76,7 +78,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationInsightsCompo _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -163,7 +167,9 @@ def list_by_resource_group( _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -261,7 +267,9 @@ async 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -321,7 +329,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) request = build_get_request( @@ -458,14 +468,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(insight_properties, (IOBase, bytes)): _content = insight_properties else: _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") @@ -605,14 +617,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(component_tags, (IOBase, bytes)): _content = component_tags else: _json = self._serialize.body(component_tags, "TagsResource") @@ -767,14 +781,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ComponentPurgeBody") @@ -846,7 +862,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) request = build_get_purge_status_request( 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 index eb567892fe6d5..dfaad64905acc 100644 --- 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 @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -67,7 +68,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) error_map = { 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 index 02146477de39d..918b73655c576 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -53,6 +54,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list( @@ -83,7 +85,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( "cls", None ) @@ -156,7 +160,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -313,14 +319,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(proactive_detection_properties, (IOBase, bytes)): _content = proactive_detection_properties else: _json = self._serialize.body( 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 index 541ee4ef23252..26662b0b051ae 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.WebTest"]: @@ -77,7 +79,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -173,7 +177,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) request = build_get_request( @@ -306,14 +312,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(web_test_definition, (IOBase, bytes)): _content = web_test_definition else: _json = self._serialize.body(web_test_definition, "WebTest") @@ -449,14 +457,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(web_test_tags, (IOBase, bytes)): _content = web_test_tags else: _json = self._serialize.body(web_test_tags, "TagsResource") @@ -525,7 +535,9 @@ async 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -571,7 +583,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.WebTest"]: _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -659,7 +673,9 @@ def list_by_component( _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { 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 index 9b52efe646f71..9a588159381e7 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +80,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +110,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +138,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +172,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,7 +208,7 @@ def build_update_tags_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -243,7 +244,7 @@ def build_purge_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -279,7 +280,7 @@ def build_get_purge_status_request( "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -308,6 +309,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ApplicationInsightsComponent"]: @@ -323,7 +325,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApplicationInsightsComponent" _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -410,7 +414,9 @@ def list_by_resource_group( _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -508,7 +514,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -566,7 +574,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) request = build_get_request( @@ -703,14 +713,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(insight_properties, (IOBase, bytes)): _content = insight_properties else: _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") @@ -850,14 +862,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(component_tags, (IOBase, bytes)): _content = component_tags else: _json = self._serialize.body(component_tags, "TagsResource") @@ -1012,14 +1026,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ComponentPurgeBody") @@ -1091,7 +1107,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) request = build_get_purge_status_request( 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 index 7f0244771668d..d19eebf0b40b7 100644 --- 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 @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -89,7 +90,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) error_map = { 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 index e5ac7ad94439d..1a6e7476bf9ca 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +57,7 @@ def build_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +91,7 @@ def build_get_request( "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,7 +126,7 @@ def build_update_request( "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,6 +157,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -186,7 +188,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( "cls", None ) @@ -259,7 +263,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -416,14 +422,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(proactive_detection_properties, (IOBase, bytes)): _content = proactive_detection_properties else: _json = self._serialize.body( 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 index 0c87f4145b727..32adbf76cc87b 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +56,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +87,7 @@ def build_get_request(resource_group_name: str, web_test_name: str, subscription "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +121,7 @@ def build_create_or_update_request( "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,7 +157,7 @@ def build_update_tags_request( "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +189,7 @@ def build_delete_request( "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +210,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +243,7 @@ def build_list_by_component_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -271,6 +272,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.WebTest"]: @@ -288,7 +290,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -384,7 +388,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) request = build_get_request( @@ -517,14 +523,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(web_test_definition, (IOBase, bytes)): _content = web_test_definition else: _json = self._serialize.body(web_test_definition, "WebTest") @@ -660,14 +668,16 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) 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, (IO, bytes)): + if isinstance(web_test_tags, (IOBase, bytes)): _content = web_test_tags else: _json = self._serialize.body(web_test_tags, "TagsResource") @@ -736,7 +746,9 @@ 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", "2018-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -782,7 +794,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.WebTest"]: _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -870,7 +884,9 @@ def list_by_component( _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-05-01-preview") + ) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { 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 index 6fee78f16538d..c96ddbdd5dd80 100644 --- 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 @@ -57,8 +57,12 @@ def __init__( 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) + self.workbooks = WorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2018-06-17-preview" + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2018-06-17-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 5f07aaadf6b2b..ea29fa90ae971 100644 --- 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 @@ -58,8 +58,12 @@ def __init__( 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) + self.workbooks = WorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2018-06-17-preview" + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2018-06-17-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index 67ff4a7c08aec..3fa65d417e579 100644 --- 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 @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 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 index 79674dcdd98d1..e78703fe9a924 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload import urllib.parse @@ -58,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -94,7 +96,9 @@ def list_by_resource_group( _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -195,7 +199,9 @@ 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", "2018-06-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_get_request( @@ -260,7 +266,9 @@ async 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", "2018-06-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -399,14 +407,16 @@ 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", "2018-06-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") @@ -560,14 +570,16 @@ 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", "2018-06-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) 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_update_parameters, (IO, bytes)): + if isinstance(workbook_update_parameters, (IOBase, bytes)): _content = workbook_update_parameters else: if workbook_update_parameters is not None: 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 index a0d920a50366b..e79bac1e347e4 100644 --- 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 @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -87,7 +88,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 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 index 7305237bc9aab..f4710b38f61b6 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +65,7 @@ def build_list_by_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -101,7 +102,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,7 +135,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,7 +169,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") @@ -205,7 +206,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") @@ -237,6 +238,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -273,7 +275,9 @@ def list_by_resource_group( _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -374,7 +378,9 @@ 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", "2018-06-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_get_request( @@ -439,7 +445,9 @@ 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", "2018-06-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -578,14 +586,16 @@ 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", "2018-06-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") @@ -739,14 +749,16 @@ 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", "2018-06-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2018-06-17-preview") + ) 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_update_parameters, (IO, bytes)): + if isinstance(workbook_update_parameters, (IOBase, bytes)): _content = workbook_update_parameters else: if workbook_update_parameters is not None: 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 index c95697b8c7152..f326f429c7256 100644 --- 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 @@ -56,7 +56,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-10-17-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index b5370f6d44949..16d0e1861987f 100644 --- 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 @@ -56,7 +56,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-10-17-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 index 982d9bbf9074c..60b3d4718a0a4 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -58,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -77,7 +79,9 @@ def list_by_resource_group( _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) error_map = { @@ -174,7 +178,9 @@ 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", "2019-10-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -239,7 +245,9 @@ async 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", "2019-10-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -370,14 +378,16 @@ 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", "2019-10-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) 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, (IO, bytes)): + if isinstance(workbook_template_properties, (IOBase, bytes)): _content = workbook_template_properties else: _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") @@ -523,14 +533,16 @@ 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", "2019-10-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) 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_update_parameters, (IO, bytes)): + if isinstance(workbook_template_update_parameters, (IOBase, bytes)): _content = workbook_template_update_parameters else: if workbook_template_update_parameters is not None: 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 index 88a2d1a189fb2..b8369b1572fee 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +56,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +87,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +120,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,7 +154,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,7 +190,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,6 +221,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.WorkbookTemplate"]: @@ -237,7 +239,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = 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")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) error_map = { @@ -334,7 +338,9 @@ 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", "2019-10-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -399,7 +405,9 @@ 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", "2019-10-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -530,14 +538,16 @@ 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", "2019-10-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) 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, (IO, bytes)): + if isinstance(workbook_template_properties, (IOBase, bytes)): _content = workbook_template_properties else: _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") @@ -683,14 +693,16 @@ 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", "2019-10-17-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-10-17-preview") + ) 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_update_parameters, (IO, bytes)): + if isinstance(workbook_template_update_parameters, (IOBase, bytes)): _content = workbook_template_update_parameters else: if workbook_template_update_parameters is not None: 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 index 5e4d3236e265e..9e0eaac47b261 100644 --- 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 @@ -54,7 +54,9 @@ 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.components = ComponentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-02-02" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 5116ade7cbeca..7c04e31983c5c 100644 --- 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 @@ -55,7 +55,9 @@ 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.components = ComponentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-02-02" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index 0c2669ffafe56..58436b42de77b 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -61,6 +62,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationInsightsComponent"]: @@ -76,7 +78,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationInsightsCompo _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._api_version or "2020-02-02")) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -164,7 +166,7 @@ def list_by_resource_group( _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._api_version or "2020-02-02")) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -263,7 +265,7 @@ async 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._api_version or "2020-02-02")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -324,7 +326,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._api_version or "2020-02-02")) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) request = build_get_request( @@ -462,14 +464,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(insight_properties, (IO, bytes)): + if isinstance(insight_properties, (IOBase, bytes)): _content = insight_properties else: _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") @@ -605,14 +607,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(component_tags, (IO, bytes)): + if isinstance(component_tags, (IOBase, bytes)): _content = component_tags else: _json = self._serialize.body(component_tags, "TagsResource") @@ -776,14 +778,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ComponentPurgeBody") @@ -856,7 +858,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._api_version or "2020-02-02")) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) request = build_get_purge_status_request( 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 index 8e39e9d3186bc..68d5bfab89c30 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +80,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,7 +113,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +144,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -177,7 +178,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,7 +214,7 @@ def build_update_tags_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,7 +250,7 @@ def build_purge_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -285,7 +286,7 @@ def build_get_purge_status_request( "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -314,6 +315,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ApplicationInsightsComponent"]: @@ -329,7 +331,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApplicationInsightsComponent" _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._api_version or "2020-02-02")) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -417,7 +419,7 @@ def list_by_resource_group( _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._api_version or "2020-02-02")) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -516,7 +518,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._api_version or "2020-02-02")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -575,7 +577,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._api_version or "2020-02-02")) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) request = build_get_request( @@ -713,14 +715,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(insight_properties, (IO, bytes)): + if isinstance(insight_properties, (IOBase, bytes)): _content = insight_properties else: _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") @@ -856,14 +858,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(component_tags, (IO, bytes)): + if isinstance(component_tags, (IOBase, bytes)): _content = component_tags else: _json = self._serialize.body(component_tags, "TagsResource") @@ -1027,14 +1029,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ComponentPurgeBody") @@ -1107,7 +1109,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._api_version or "2020-02-02")) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) request = build_get_purge_status_request( 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 index 6cf130a75002a..57b815ab47720 100644 --- 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 @@ -55,7 +55,9 @@ 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.components = ComponentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-02-02-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 5e0d8e47a53b2..33331526834be 100644 --- 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 @@ -55,7 +55,9 @@ 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.components = ComponentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-02-02-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index 2779db85e19d1..96d1c000a9b94 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -61,6 +62,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationInsightsComponent"]: @@ -76,7 +78,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationInsightsCompo _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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -164,7 +168,9 @@ def list_by_resource_group( _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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -263,7 +269,9 @@ async 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -324,7 +332,9 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) request = build_get_request( @@ -462,14 +472,16 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) 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, (IO, bytes)): + if isinstance(insight_properties, (IOBase, bytes)): _content = insight_properties else: _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") @@ -606,14 +618,16 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) 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, (IO, bytes)): + if isinstance(component_tags, (IOBase, bytes)): _content = component_tags else: _json = self._serialize.body(component_tags, "TagsResource") @@ -765,14 +779,16 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) 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, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ComponentPurgeBody") @@ -845,7 +861,9 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) request = build_get_purge_status_request( 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 index 228ecb24fb0fa..302497ff323c6 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +80,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,7 +113,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +144,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -177,7 +178,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,7 +214,7 @@ def build_update_tags_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,7 +250,7 @@ def build_purge_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -285,7 +286,7 @@ def build_get_purge_status_request( "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -314,6 +315,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ApplicationInsightsComponent"]: @@ -329,7 +331,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApplicationInsightsComponent" _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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -417,7 +421,9 @@ def list_by_resource_group( _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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map = { @@ -516,7 +522,9 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -575,7 +583,9 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) request = build_get_request( @@ -713,14 +723,16 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) 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, (IO, bytes)): + if isinstance(insight_properties, (IOBase, bytes)): _content = insight_properties else: _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") @@ -857,14 +869,16 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) 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, (IO, bytes)): + if isinstance(component_tags, (IOBase, bytes)): _content = component_tags else: _json = self._serialize.body(component_tags, "TagsResource") @@ -1016,14 +1030,16 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) 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, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ComponentPurgeBody") @@ -1096,7 +1112,9 @@ 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-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-02-02-preview") + ) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) request = build_get_purge_status_request( 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 index b5d57d9784c6e..2de4fbfa22f1a 100644 --- 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 @@ -56,7 +56,7 @@ def __init__( 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 + self._client, self._config, self._serialize, self._deserialize, "2020-03-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 3c90650e8347a..4aacbb6f60ed6 100644 --- 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 @@ -56,7 +56,7 @@ def __init__( 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 + self._client, self._config, self._serialize, self._deserialize, "2020-03-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 index 6720f8ddc4ff8..46d789b1b9ff3 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -54,6 +55,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -87,7 +89,9 @@ 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._api_version or "2020-03-01-preview") + ) cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) request = build_get_request( @@ -242,14 +246,16 @@ 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._api_version or "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" _json = None _content = None - if isinstance(linked_storage_accounts_properties, (IO, bytes)): + if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): _content = linked_storage_accounts_properties else: _json = self._serialize.body(linked_storage_accounts_properties, "ComponentLinkedStorageAccounts") @@ -410,14 +416,16 @@ 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._api_version or "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" _json = None _content = None - if isinstance(linked_storage_accounts_properties, (IO, bytes)): + if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): _content = linked_storage_accounts_properties else: _json = self._serialize.body(linked_storage_accounts_properties, "ComponentLinkedStorageAccountsPatch") @@ -492,7 +500,9 @@ async 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._api_version or "2020-03-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( 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 index d8b3032fb3af9..c85f3de93c204 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +62,7 @@ def build_get_request( "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +101,7 @@ def build_create_and_update_request( "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -141,7 +142,7 @@ def build_update_request( "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +182,7 @@ def build_delete_request( "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,6 +211,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -243,7 +245,9 @@ 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._api_version or "2020-03-01-preview") + ) cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) request = build_get_request( @@ -398,14 +402,16 @@ 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._api_version or "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" _json = None _content = None - if isinstance(linked_storage_accounts_properties, (IO, bytes)): + if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): _content = linked_storage_accounts_properties else: _json = self._serialize.body(linked_storage_accounts_properties, "ComponentLinkedStorageAccounts") @@ -566,14 +572,16 @@ 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._api_version or "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" _json = None _content = None - if isinstance(linked_storage_accounts_properties, (IO, bytes)): + if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): _content = linked_storage_accounts_properties else: _json = self._serialize.body(linked_storage_accounts_properties, "ComponentLinkedStorageAccountsPatch") @@ -648,7 +656,9 @@ 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._api_version or "2020-03-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( 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 index 8b35f9a264971..d0229e2b572c9 100644 --- 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 @@ -49,8 +49,12 @@ def __init__( 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) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2020-06-02-preview" + ) + self.live_token = LiveTokenOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-06-02-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index b1d0c3f023a63..96955e944ab12 100644 --- 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 @@ -50,8 +50,12 @@ def __init__( 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) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2020-06-02-preview" + ) + self.live_token = LiveTokenOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-06-02-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index 426b55642ebba..85b5be5e24139 100644 --- 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: @@ -72,7 +73,9 @@ 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", "2020-06-02-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-06-02-preview") + ) cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) request = build_get_request( 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 index 5dd93f3a9a9b0..11ac1b03e53c3 100644 --- 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 @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationLive"]: @@ -67,7 +68,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationLive"]: _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-06-02-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-06-02-preview") + ) cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) error_map = { 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 index e837ea1a79bdd..081729e17aef0 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +47,7 @@ def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,6 +76,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: @@ -99,7 +100,9 @@ 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", "2020-06-02-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-06-02-preview") + ) cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) request = build_get_request( 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 index e208b80578263..935719711c8ac 100644 --- 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 @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.OperationLive"]: @@ -89,7 +90,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationLive"]: _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-06-02-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-06-02-preview") + ) cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) error_map = { 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 index 7fc883d8f3392..f87342641dc1c 100644 --- 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 @@ -56,7 +56,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-11-20" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 27af2a651683f..c68e2687869a6 100644 --- 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 @@ -56,7 +56,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-11-20" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 index 3a2abc70ea01d..f617d5e501737 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -58,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -77,7 +79,7 @@ def list_by_resource_group( _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._api_version or "2020-11-20")) cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) error_map = { @@ -174,7 +176,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._api_version or "2020-11-20")) cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -239,7 +241,7 @@ async 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._api_version or "2020-11-20")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -370,14 +372,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(workbook_template_properties, (IO, bytes)): + if isinstance(workbook_template_properties, (IOBase, bytes)): _content = workbook_template_properties else: _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") @@ -522,14 +524,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(workbook_template_update_parameters, (IO, bytes)): + if isinstance(workbook_template_update_parameters, (IOBase, bytes)): _content = workbook_template_update_parameters else: if workbook_template_update_parameters is not None: 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 index 52712c13c455f..2584e55525ece 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +56,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +87,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +120,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,7 +154,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,7 +190,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,6 +221,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.WorkbookTemplate"]: @@ -237,7 +239,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2020-11-20")) cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) error_map = { @@ -334,7 +336,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._api_version or "2020-11-20")) cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -399,7 +401,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._api_version or "2020-11-20")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -530,14 +532,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(workbook_template_properties, (IO, bytes)): + if isinstance(workbook_template_properties, (IOBase, bytes)): _content = workbook_template_properties else: _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") @@ -682,14 +684,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(workbook_template_update_parameters, (IO, bytes)): + if isinstance(workbook_template_update_parameters, (IOBase, bytes)): _content = workbook_template_update_parameters else: if workbook_template_update_parameters is not None: 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 index 7ddcf1fd7e6e7..1e0e8e003325d 100644 --- 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 @@ -55,7 +55,9 @@ def __init__( 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) + self.my_workbooks = MyWorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-03-08" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index afd5ab6588968..6b7ec91cdb5b6 100644 --- 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 @@ -55,7 +55,9 @@ def __init__( 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) + self.my_workbooks = MyWorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-03-08" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index a26477fc4c3d4..adebc4193cd69 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -96,7 +98,7 @@ def list_by_resource_group( _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._api_version or "2021-03-08")) cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -200,7 +202,7 @@ def list_by_subscription( _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._api_version or "2021-03-08")) cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -297,7 +299,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", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-08")) cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) request = build_get_request( @@ -362,7 +364,7 @@ async 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", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-08")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -503,14 +505,14 @@ 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", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-08")) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "MyWorkbook") @@ -665,14 +667,14 @@ 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", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-08")) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "MyWorkbook") 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 index 28caa57ec73f4..eade752743fb7 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +65,7 @@ def build_list_by_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -102,7 +103,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -138,7 +139,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +172,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,7 +211,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if source_id is not None: @@ -253,7 +254,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if source_id is not None: @@ -286,6 +287,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group( @@ -323,7 +325,7 @@ def list_by_resource_group( _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._api_version or "2021-03-08")) cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -427,7 +429,7 @@ def list_by_subscription( _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._api_version or "2021-03-08")) cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -524,7 +526,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", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-08")) cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) request = build_get_request( @@ -589,7 +591,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", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-08")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -730,14 +732,14 @@ 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", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-08")) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "MyWorkbook") @@ -892,14 +894,14 @@ 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", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-08")) 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, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "MyWorkbook") 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 index 8768e92495489..53fec640775d8 100644 --- 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 @@ -54,7 +54,9 @@ def __init__( 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.workbooks = WorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 521be975273aa..735f61389cea5 100644 --- 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 @@ -55,7 +55,9 @@ def __init__( 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.workbooks = WorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index 4c7adfef1eed6..f6b46baca143c 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload import urllib.parse @@ -61,6 +62,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -90,7 +92,7 @@ def list_by_subscription( _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-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -198,7 +200,7 @@ def list_by_resource_group( _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-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -305,7 +307,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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_get_request( @@ -371,7 +373,7 @@ async 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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -512,14 +514,14 @@ 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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-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" _json = None _content = None - if isinstance(workbook_properties, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") @@ -676,14 +678,14 @@ 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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-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" _json = None _content = None - if isinstance(workbook_update_parameters, (IO, bytes)): + if isinstance(workbook_update_parameters, (IOBase, bytes)): _content = workbook_update_parameters else: if workbook_update_parameters is not None: @@ -754,7 +756,7 @@ def revisions_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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -856,7 +858,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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_revision_get_request( 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 index 5d76fa65a6616..3dc4017a89e0a 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +57,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -100,7 +101,7 @@ def build_list_by_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -145,7 +146,7 @@ def build_get_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,7 +181,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +220,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if source_id is not None: @@ -262,7 +263,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if source_id is not None: @@ -299,7 +300,7 @@ def build_revisions_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -333,7 +334,7 @@ def build_revision_get_request( "revisionId": _SERIALIZER.url("revision_id", revision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,6 +363,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -391,7 +393,7 @@ def list_by_subscription( _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-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -499,7 +501,7 @@ def list_by_resource_group( _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-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -606,7 +608,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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_get_request( @@ -672,7 +674,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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -813,14 +815,14 @@ 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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-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" _json = None _content = None - if isinstance(workbook_properties, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") @@ -977,14 +979,14 @@ 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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-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" _json = None _content = None - if isinstance(workbook_update_parameters, (IO, bytes)): + if isinstance(workbook_update_parameters, (IOBase, bytes)): _content = workbook_update_parameters else: if workbook_update_parameters is not None: @@ -1055,7 +1057,7 @@ def revisions_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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -1157,7 +1159,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", "2021-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_revision_get_request( 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 index 1859ce9c6b298..ffa1ab38616c7 100644 --- 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 @@ -46,7 +46,9 @@ def __init__( 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) + self.live_token = LiveTokenOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-10-14" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index d38ce20064d69..75a4730c435d4 100644 --- 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 @@ -46,7 +46,9 @@ def __init__( 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) + self.live_token = LiveTokenOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-10-14" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index c5ce73f8e10de..a430a25870e20 100644 --- 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: @@ -72,7 +73,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._api_version or "2021-10-14")) cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) request = build_get_request( 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 index db859621dd320..5adf7c81dc0b5 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +47,7 @@ def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,6 +76,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: @@ -99,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._api_version or "2021-10-14")) cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) request = build_get_request( 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 index 2f8d34f2bb1b3..07cd21c0b1433 100644 --- 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 @@ -54,7 +54,9 @@ def __init__( 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.workbooks = WorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-04-01" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index a99dd800b1fa0..e148124818047 100644 --- 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 @@ -55,7 +55,9 @@ def __init__( 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.workbooks = WorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-04-01" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index b167621097b56..bf390cb7ec64d 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload import urllib.parse @@ -61,6 +62,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -90,7 +92,7 @@ def list_by_subscription( _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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -198,7 +200,7 @@ def list_by_resource_group( _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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -305,7 +307,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", "2022-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_get_request( @@ -371,7 +373,7 @@ async 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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -512,14 +514,14 @@ 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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-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" _json = None _content = None - if isinstance(workbook_properties, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") @@ -676,14 +678,14 @@ 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", "2022-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-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" _json = None _content = None - if isinstance(workbook_update_parameters, (IO, bytes)): + if isinstance(workbook_update_parameters, (IOBase, bytes)): _content = workbook_update_parameters else: if workbook_update_parameters is not None: @@ -754,7 +756,7 @@ def revisions_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", "2022-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -856,7 +858,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", "2022-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_revision_get_request( 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 index 5bae3628e5499..a1112ca3b605e 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +57,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -100,7 +101,7 @@ def build_list_by_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["category"] = _SERIALIZER.query("category", category, "str") @@ -145,7 +146,7 @@ def build_get_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,7 +181,7 @@ def build_delete_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +220,7 @@ def build_create_or_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if source_id is not None: @@ -262,7 +263,7 @@ def build_update_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if source_id is not None: @@ -299,7 +300,7 @@ def build_revisions_list_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -333,7 +334,7 @@ def build_revision_get_request( "revisionId": _SERIALIZER.url("revision_id", revision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,6 +363,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -391,7 +393,7 @@ def list_by_subscription( _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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -499,7 +501,7 @@ def list_by_resource_group( _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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -606,7 +608,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", "2022-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_get_request( @@ -672,7 +674,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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -813,14 +815,14 @@ 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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-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" _json = None _content = None - if isinstance(workbook_properties, (IO, bytes)): + if isinstance(workbook_properties, (IOBase, bytes)): _content = workbook_properties else: _json = self._serialize.body(workbook_properties, "Workbook") @@ -977,14 +979,14 @@ 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", "2022-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-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" _json = None _content = None - if isinstance(workbook_update_parameters, (IO, bytes)): + if isinstance(workbook_update_parameters, (IOBase, bytes)): _content = workbook_update_parameters else: if workbook_update_parameters is not None: @@ -1055,7 +1057,7 @@ def revisions_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", "2022-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map = { @@ -1157,7 +1159,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", "2022-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) request = build_revision_get_request( 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 index 0ad3172df0501..84f8383a99f71 100644 --- 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 @@ -54,7 +54,9 @@ def __init__( 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) + self.web_tests = WebTestsOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-06-15" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_vendor.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_vendor.py index bd0df84f5319f..0dafe0e287ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_vendor.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c67..e5754a47ce68f 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 8b411d38bef30..42f382cccb429 100644 --- 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 @@ -55,7 +55,9 @@ def __init__( 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) + self.web_tests = WebTestsOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-06-15" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 index 5211a36218b46..851b09639bb2c 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.WebTest"]: @@ -77,7 +79,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2022-06-15")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -173,7 +175,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._api_version or "2022-06-15")) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) request = build_get_request( @@ -305,14 +307,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(web_test_definition, (IO, bytes)): + if isinstance(web_test_definition, (IOBase, bytes)): _content = web_test_definition else: _json = self._serialize.body(web_test_definition, "WebTest") @@ -449,14 +451,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(web_test_tags, (IO, bytes)): + if isinstance(web_test_tags, (IOBase, bytes)): _content = web_test_tags else: _json = self._serialize.body(web_test_tags, "TagsResource") @@ -525,7 +527,7 @@ async 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._api_version or "2022-06-15")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -571,7 +573,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.WebTest"]: _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._api_version or "2022-06-15")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -659,7 +661,7 @@ def list_by_component( _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._api_version or "2022-06-15")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { 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 index 5f0c35f49fda2..1952ca95eb716 100644 --- 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +56,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +87,7 @@ def build_get_request(resource_group_name: str, web_test_name: str, subscription "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +121,7 @@ def build_create_or_update_request( "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,7 +157,7 @@ def build_update_tags_request( "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +189,7 @@ def build_delete_request( "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +210,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +243,7 @@ def build_list_by_component_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -271,6 +272,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.WebTest"]: @@ -288,7 +290,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2022-06-15")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -384,7 +386,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._api_version or "2022-06-15")) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) request = build_get_request( @@ -516,14 +518,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(web_test_definition, (IO, bytes)): + if isinstance(web_test_definition, (IOBase, bytes)): _content = web_test_definition else: _json = self._serialize.body(web_test_definition, "WebTest") @@ -660,14 +662,14 @@ 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._api_version or "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" _json = None _content = None - if isinstance(web_test_tags, (IO, bytes)): + if isinstance(web_test_tags, (IOBase, bytes)): _content = web_test_tags else: _json = self._serialize.body(web_test_tags, "TagsResource") @@ -736,7 +738,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._api_version or "2022-06-15")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -782,7 +784,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.WebTest"]: _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._api_version or "2022-06-15")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { @@ -870,7 +872,7 @@ def list_by_component( _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._api_version or "2022-06-15")) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_create.py new file mode 100644 index 0000000000000..10920e018b6bd --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_create.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code 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 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={ + "kind": "ping", + "location": "South Central US", + "properties": { + "Configuration": { + "WebTest": '' + }, + "Description": "Ping web test alert for mytestwebapp", + "Enabled": True, + "Frequency": 900, + "Kind": "ping", + "Locations": [{"Id": "us-fl-mia-edge"}], + "Name": "my-webtest-my-component", + "RetryEnabled": True, + "SyntheticMonitorId": "my-webtest-my-component", + "Timeout": 120, + }, + }, + ) + 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/web_test_create_standard.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_create_standard.py new file mode 100644 index 0000000000000..b14c533b2da00 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_create_standard.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.applicationinsights 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": "South Central US", + "properties": { + "Description": "Ping web test alert for mytestwebapp", + "Enabled": True, + "Frequency": 900, + "Kind": "standard", + "Locations": [{"Id": "us-fl-mia-edge"}], + "Name": "my-webtest-my-component", + "Request": { + "Headers": [ + {"key": "Content-Language", "value": "de-DE"}, + {"key": "Accept-Language", "value": "de-DE"}, + ], + "HttpVerb": "POST", + "RequestBody": "SGVsbG8gd29ybGQ=", + "RequestUrl": "https://bing.com", + }, + "RetryEnabled": True, + "SyntheticMonitorId": "my-webtest-my-component", + "Timeout": 120, + "ValidationRules": {"SSLCertRemainingLifetimeCheck": 100, "SSLCheck": True}, + }, + }, + ) + 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/web_test_delete.py index 2b6ab8be3a1da..52b2493fa7e11 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_delete.py @@ -29,11 +29,10 @@ def main(): subscription_id="subid", ) - response = client.web_tests.delete( + client.web_tests.delete( 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/WebTestDelete.json diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_update.py new file mode 100644 index 0000000000000..8d5904eca8bdf --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_update.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code 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 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={ + "kind": "ping", + "location": "South Central US", + "properties": { + "Configuration": { + "WebTest": '' + }, + "Frequency": 600, + "Kind": "ping", + "Locations": [{"Id": "us-fl-mia-edge"}, {"Id": "apac-hk-hkn-azr"}], + "Name": "my-webtest-my-component", + "SyntheticMonitorId": "my-webtest-my-component", + "Timeout": 30, + }, + }, + ) + 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/web_test_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_update_tags_only.py new file mode 100644 index 0000000000000..fc759b95aacbd --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_update_tags_only.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code 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 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": { + "Color": "AzureBlue", + "CustomField-01": "This is a random value", + "SystemType": "A08", + "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": "Resource", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestUpdateTagsOnly.json +if __name__ == "__main__": + main()