From 2882ff35ab6d358752854f4c423db66877ced236 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 11 Jan 2021 18:10:50 +0000 Subject: [PATCH] CodeGen from PR 12371 in Azure/azure-rest-api-specs Merge 7ea8f0f10ed3435fe94a02ad69f7c57fc309a4be into fee34e8576b727aafde7db9d27e37cd612a9a687 --- .../azure/mgmt/monitor/_configuration.py | 4 +- .../azure/mgmt/monitor/_monitor_client.py | 165 ++- .../azure/mgmt/monitor/aio/_configuration.py | 4 +- .../azure/mgmt/monitor/aio/_monitor_client.py | 165 ++- .../monitor/v2015_04_01/_configuration.py | 4 +- .../mgmt/monitor/v2015_04_01/_metadata.json | 19 +- .../monitor/v2015_04_01/_monitor_client.py | 3 +- .../monitor/v2015_04_01/aio/_configuration.py | 4 +- .../v2015_04_01/aio/_monitor_client.py | 3 +- .../operations/_activity_logs_operations.py | 12 +- .../_autoscale_settings_operations.py | 52 +- .../_event_categories_operations.py | 10 +- .../v2015_04_01/aio/operations/_operations.py | 8 +- .../_tenant_activity_logs_operations.py | 10 +- .../operations/_activity_logs_operations.py | 12 +- .../_autoscale_settings_operations.py | 52 +- .../_event_categories_operations.py | 10 +- .../v2015_04_01/operations/_operations.py | 8 +- .../_tenant_activity_logs_operations.py | 10 +- .../monitor/v2015_07_01/_configuration.py | 2 +- .../mgmt/monitor/v2015_07_01/_metadata.json | 11 +- .../monitor/v2015_07_01/_monitor_client.py | 1 - .../monitor/v2015_07_01/aio/_configuration.py | 2 +- .../v2015_07_01/aio/_monitor_client.py | 1 - ..._service_diagnostic_settings_operations.py | 16 +- ..._service_diagnostic_settings_operations.py | 16 +- .../monitor/v2016_03_01/_configuration.py | 4 +- .../mgmt/monitor/v2016_03_01/_metadata.json | 19 +- .../monitor/v2016_03_01/_monitor_client.py | 3 +- .../monitor/v2016_03_01/aio/_configuration.py | 4 +- .../v2016_03_01/aio/_monitor_client.py | 3 +- .../_alert_rule_incidents_operations.py | 18 +- .../aio/operations/_alert_rules_operations.py | 44 +- .../operations/_log_profiles_operations.py | 38 +- .../_metric_definitions_operations.py | 10 +- .../_alert_rule_incidents_operations.py | 18 +- .../operations/_alert_rules_operations.py | 44 +- .../operations/_log_profiles_operations.py | 38 +- .../_metric_definitions_operations.py | 10 +- .../monitor/v2016_09_01/_configuration.py | 2 +- .../mgmt/monitor/v2016_09_01/_metadata.json | 11 +- .../monitor/v2016_09_01/_monitor_client.py | 1 - .../monitor/v2016_09_01/aio/_configuration.py | 2 +- .../v2016_09_01/aio/_monitor_client.py | 1 - .../aio/operations/_metrics_operations.py | 10 +- ..._service_diagnostic_settings_operations.py | 24 +- .../operations/_metrics_operations.py | 10 +- ..._service_diagnostic_settings_operations.py | 24 +- .../v2017_03_01_preview/_configuration.py | 4 +- .../v2017_03_01_preview/_metadata.json | 19 +- .../v2017_03_01_preview/_monitor_client.py | 3 +- .../v2017_03_01_preview/aio/_configuration.py | 4 +- .../aio/_monitor_client.py | 3 +- .../_activity_log_alerts_operations.py | 52 +- .../_activity_log_alerts_operations.py | 52 +- .../monitor/v2017_04_01/_configuration.py | 4 +- .../mgmt/monitor/v2017_04_01/_metadata.json | 19 +- .../monitor/v2017_04_01/_monitor_client.py | 3 +- .../monitor/v2017_04_01/aio/_configuration.py | 4 +- .../v2017_04_01/aio/_monitor_client.py | 3 +- .../operations/_action_groups_operations.py | 58 +- .../_activity_log_alerts_operations.py | 52 +- .../operations/_action_groups_operations.py | 58 +- .../_activity_log_alerts_operations.py | 52 +- .../v2017_05_01_preview/_configuration.py | 8 +- .../v2017_05_01_preview/_metadata.json | 25 +- .../v2017_05_01_preview/_monitor_client.py | 6 +- .../v2017_05_01_preview/aio/_configuration.py | 8 +- .../aio/_monitor_client.py | 6 +- ...diagnostic_settings_category_operations.py | 16 +- .../_diagnostic_settings_operations.py | 26 +- .../_metric_definitions_operations.py | 10 +- .../aio/operations/_metrics_operations.py | 12 +- ...cription_diagnostic_settings_operations.py | 46 +- ...diagnostic_settings_category_operations.py | 16 +- .../_diagnostic_settings_operations.py | 26 +- .../_metric_definitions_operations.py | 10 +- .../operations/_metrics_operations.py | 12 +- ...cription_diagnostic_settings_operations.py | 46 +- .../v2017_11_01_preview/_configuration.py | 2 +- .../v2017_11_01_preview/_metadata.json | 11 +- .../v2017_11_01_preview/_monitor_client.py | 1 - .../v2017_11_01_preview/aio/_configuration.py | 2 +- .../aio/_monitor_client.py | 1 - .../operations/_metric_baseline_operations.py | 22 +- .../v2017_11_01_preview/models/_models.py | 4 + .../v2017_11_01_preview/models/_models_py3.py | 5 + .../operations/_metric_baseline_operations.py | 22 +- .../v2017_12_01_preview/_configuration.py | 2 +- .../v2017_12_01_preview/_metadata.json | 11 +- .../v2017_12_01_preview/_monitor_client.py | 1 - .../v2017_12_01_preview/aio/_configuration.py | 2 +- .../aio/_monitor_client.py | 1 - .../_metric_namespaces_operations.py | 10 +- .../_metric_namespaces_operations.py | 10 +- .../monitor/v2018_01_01/_configuration.py | 2 +- .../mgmt/monitor/v2018_01_01/_metadata.json | 11 +- .../monitor/v2018_01_01/_monitor_client.py | 1 - .../monitor/v2018_01_01/aio/_configuration.py | 2 +- .../v2018_01_01/aio/_monitor_client.py | 1 - .../_metric_definitions_operations.py | 10 +- .../aio/operations/_metrics_operations.py | 12 +- .../_metric_definitions_operations.py | 10 +- .../operations/_metrics_operations.py | 12 +- .../monitor/v2018_03_01/_configuration.py | 4 +- .../mgmt/monitor/v2018_03_01/_metadata.json | 19 +- .../monitor/v2018_03_01/_monitor_client.py | 3 +- .../monitor/v2018_03_01/aio/_configuration.py | 4 +- .../v2018_03_01/aio/_monitor_client.py | 3 +- .../operations/_action_groups_operations.py | 58 +- .../operations/_metric_alerts_operations.py | 55 +- .../_metric_alerts_status_operations.py | 20 +- .../monitor/v2018_03_01/models/__init__.py | 4 +- .../monitor/v2018_03_01/models/_models.py | 28 +- .../monitor/v2018_03_01/models/_models_py3.py | 34 +- .../models/_monitor_client_enums.py | 2 +- .../operations/_action_groups_operations.py | 58 +- .../operations/_metric_alerts_operations.py | 55 +- .../_metric_alerts_status_operations.py | 20 +- .../monitor/v2018_04_16/_configuration.py | 4 +- .../mgmt/monitor/v2018_04_16/_metadata.json | 19 +- .../monitor/v2018_04_16/_monitor_client.py | 3 +- .../monitor/v2018_04_16/aio/_configuration.py | 4 +- .../v2018_04_16/aio/_monitor_client.py | 3 +- .../_scheduled_query_rules_operations.py | 52 +- .../_scheduled_query_rules_operations.py | 52 +- .../v2018_06_01_preview/_configuration.py | 4 +- .../v2018_06_01_preview/_metadata.json | 19 +- .../v2018_06_01_preview/_monitor_client.py | 3 +- .../v2018_06_01_preview/aio/_configuration.py | 4 +- .../aio/_monitor_client.py | 3 +- ...nostics_settings_association_operations.py | 44 +- .../_guest_diagnostics_settings_operations.py | 52 +- ...nostics_settings_association_operations.py | 44 +- .../_guest_diagnostics_settings_operations.py | 52 +- .../monitor/v2018_09_01/_configuration.py | 4 +- .../mgmt/monitor/v2018_09_01/_metadata.json | 19 +- .../monitor/v2018_09_01/_monitor_client.py | 3 +- .../monitor/v2018_09_01/aio/_configuration.py | 4 +- .../v2018_09_01/aio/_monitor_client.py | 3 +- .../operations/_action_groups_operations.py | 58 +- .../aio/operations/_baseline_operations.py | 14 +- .../operations/_metric_baseline_operations.py | 24 +- .../monitor/v2018_09_01/models/__init__.py | 3 + .../monitor/v2018_09_01/models/_models.py | 36 + .../monitor/v2018_09_01/models/_models_py3.py | 42 + .../operations/_action_groups_operations.py | 58 +- .../operations/_baseline_operations.py | 14 +- .../operations/_metric_baseline_operations.py | 24 +- .../v2018_11_27_preview/_configuration.py | 2 +- .../v2018_11_27_preview/_metadata.json | 11 +- .../v2018_11_27_preview/_monitor_client.py | 1 - .../v2018_11_27_preview/aio/_configuration.py | 2 +- .../aio/_monitor_client.py | 1 - .../aio/operations/_vm_insights_operations.py | 10 +- .../operations/_vm_insights_operations.py | 10 +- .../monitor/v2019_03_01/_configuration.py | 4 +- .../mgmt/monitor/v2019_03_01/_metadata.json | 19 +- .../monitor/v2019_03_01/_monitor_client.py | 3 +- .../monitor/v2019_03_01/aio/_configuration.py | 4 +- .../v2019_03_01/aio/_monitor_client.py | 3 +- .../operations/_action_groups_operations.py | 58 +- .../aio/operations/_baselines_operations.py | 14 +- .../operations/_action_groups_operations.py | 58 +- .../operations/_baselines_operations.py | 14 +- .../monitor/v2019_06_01/_configuration.py | 4 +- .../mgmt/monitor/v2019_06_01/_metadata.json | 19 +- .../monitor/v2019_06_01/_monitor_client.py | 3 +- .../monitor/v2019_06_01/aio/_configuration.py | 4 +- .../v2019_06_01/aio/_monitor_client.py | 3 +- .../operations/_action_groups_operations.py | 58 +- .../operations/_action_groups_operations.py | 58 +- .../monitor/v2019_10_17/_configuration.py | 4 +- .../mgmt/monitor/v2019_10_17/_metadata.json | 19 +- .../monitor/v2019_10_17/_monitor_client.py | 3 +- .../monitor/v2019_10_17/aio/_configuration.py | 4 +- .../v2019_10_17/aio/_monitor_client.py | 3 +- ...private_endpoint_connections_operations.py | 50 +- .../_private_link_resources_operations.py | 16 +- ..._link_scope_operation_status_operations.py | 10 +- ...rivate_link_scoped_resources_operations.py | 50 +- .../_private_link_scopes_operations.py | 48 +- ...private_endpoint_connections_operations.py | 50 +- .../_private_link_resources_operations.py | 16 +- ..._link_scope_operation_status_operations.py | 10 +- ...rivate_link_scoped_resources_operations.py | 50 +- .../_private_link_scopes_operations.py | 48 +- .../monitor/v2019_11_01_preview/__init__.py | 16 + .../v2019_11_01_preview/_configuration.py | 70 + .../v2019_11_01_preview/_metadata.json | 62 + .../v2019_11_01_preview/_monitor_client.py | 73 + .../v2019_11_01_preview/aio/__init__.py | 10 + .../v2019_11_01_preview/aio/_configuration.py | 66 + .../aio/_monitor_client.py | 67 + .../aio/operations/__init__.py | 15 + ...collection_rule_associations_operations.py | 384 ++++++ .../_data_collection_rules_operations.py | 455 +++++++ .../v2019_11_01_preview/models/__init__.py | 122 ++ .../v2019_11_01_preview/models/_models.py | 1089 +++++++++++++++ .../v2019_11_01_preview/models/_models_py3.py | 1174 +++++++++++++++++ .../models/_monitor_client_enums.py | 161 +++ .../operations/__init__.py | 15 + ...collection_rule_associations_operations.py | 393 ++++++ .../_data_collection_rules_operations.py | 465 +++++++ .../mgmt/monitor/v2019_11_01_preview/py.typed | 1 + .../v2020_01_01_preview/_configuration.py | 2 +- .../v2020_01_01_preview/_metadata.json | 11 +- .../v2020_01_01_preview/_monitor_client.py | 1 - .../v2020_01_01_preview/aio/_configuration.py | 2 +- .../aio/_monitor_client.py | 1 - ...nt_group_diagnostic_settings_operations.py | 26 +- ...nt_group_diagnostic_settings_operations.py | 26 +- .../monitor/v2020_05_01_preview/__init__.py | 16 + .../v2020_05_01_preview/_configuration.py | 70 + .../v2020_05_01_preview/_metadata.json | 61 + .../v2020_05_01_preview/_monitor_client.py | 68 + .../v2020_05_01_preview/aio/__init__.py | 10 + .../v2020_05_01_preview/aio/_configuration.py | 66 + .../aio/_monitor_client.py | 62 + .../aio/operations/__init__.py | 13 + .../_scheduled_query_rules_operations.py | 433 ++++++ .../v2020_05_01_preview/models/__init__.py | 63 + .../v2020_05_01_preview/models/_models.py | 530 ++++++++ .../v2020_05_01_preview/models/_models_py3.py | 588 +++++++++ .../models/_monitor_client_enums.py | 64 + .../operations/__init__.py | 13 + .../_scheduled_query_rules_operations.py | 443 +++++++ .../mgmt/monitor/v2020_05_01_preview/py.typed | 1 + 228 files changed, 9072 insertions(+), 1688 deletions(-) create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/py.typed create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_client_enums.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/py.typed diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py index 210f8cfcbcc6c..2bc4e47f80c84 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py @@ -25,7 +25,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_client.py index 4514d1bbbc92e..4727085f7bf72 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_client.py @@ -36,7 +36,7 @@ class MonitorClient(MultiApiClientMixin, _SDKClient): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str api_version: API version to use if no profile is provided, or if missing in profile. @@ -47,7 +47,7 @@ class MonitorClient(MultiApiClientMixin, _SDKClient): """ DEFAULT_API_VERSION = '2019-10-17-preview' - _PROFILE_TAG = "azure.mgmt.eventhub.MonitorClient" + _PROFILE_TAG = "azure.mgmt.monitor.MonitorClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, @@ -107,25 +107,27 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: - * 2015-04-01: :mod:`v2015_04_01.models` - * 2015-07-01: :mod:`v2015_07_01.models` - * 2016-03-01: :mod:`v2016_03_01.models` - * 2016-09-01: :mod:`v2016_09_01.models` - * 2017-03-01-preview: :mod:`v2017_03_01_preview.models` - * 2017-04-01: :mod:`v2017_04_01.models` - * 2017-05-01-preview: :mod:`v2017_05_01_preview.models` - * 2017-11-01-preview: :mod:`v2017_11_01_preview.models` - * 2017-12-01-preview: :mod:`v2017_12_01_preview.models` - * 2018-01-01: :mod:`v2018_01_01.models` - * 2018-03-01: :mod:`v2018_03_01.models` - * 2018-04-16: :mod:`v2018_04_16.models` - * 2018-06-01-preview: :mod:`v2018_06_01_preview.models` - * 2018-09-01: :mod:`v2018_09_01.models` - * 2018-11-27-preview: :mod:`v2018_11_27_preview.models` - * 2019-03-01: :mod:`v2019_03_01.models` - * 2019-06-01: :mod:`v2019_06_01.models` - * 2019-10-17-preview: :mod:`v2019_10_17.models` - * 2020-01-01-preview: :mod:`v2020_01_01_preview.models` + * 2015-04-01: :mod:`v2015_04_01.models` + * 2015-07-01: :mod:`v2015_07_01.models` + * 2016-03-01: :mod:`v2016_03_01.models` + * 2016-09-01: :mod:`v2016_09_01.models` + * 2017-03-01-preview: :mod:`v2017_03_01_preview.models` + * 2017-04-01: :mod:`v2017_04_01.models` + * 2017-05-01-preview: :mod:`v2017_05_01_preview.models` + * 2017-11-01-preview: :mod:`v2017_11_01_preview.models` + * 2017-12-01-preview: :mod:`v2017_12_01_preview.models` + * 2018-01-01: :mod:`v2018_01_01.models` + * 2018-03-01: :mod:`v2018_03_01.models` + * 2018-04-16: :mod:`v2018_04_16.models` + * 2018-06-01-preview: :mod:`v2018_06_01_preview.models` + * 2018-09-01: :mod:`v2018_09_01.models` + * 2018-11-27-preview: :mod:`v2018_11_27_preview.models` + * 2019-03-01: :mod:`v2019_03_01.models` + * 2019-06-01: :mod:`v2019_06_01.models` + * 2019-10-17-preview: :mod:`v2019_10_17.models` + * 2019-11-01-preview: :mod:`v2019_11_01_preview.models` + * 2020-01-01-preview: :mod:`v2020_01_01_preview.models` + * 2020-05-01-preview: :mod:`v2020_05_01_preview.models` """ if api_version == '2015-04-01': from .v2015_04_01 import models @@ -181,20 +183,26 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-10-17-preview': from .v2019_10_17 import models return models + elif api_version == '2019-11-01-preview': + from .v2019_11_01_preview import models + return models elif api_version == '2020-01-01-preview': from .v2020_01_01_preview import models return models + elif api_version == '2020-05-01-preview': + from .v2020_05_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property def action_groups(self): """Instance depends on the API version: - * 2017-04-01: :class:`ActionGroupsOperations` - * 2018-03-01: :class:`ActionGroupsOperations` - * 2018-09-01: :class:`ActionGroupsOperations` - * 2019-03-01: :class:`ActionGroupsOperations` - * 2019-06-01: :class:`ActionGroupsOperations` + * 2017-04-01: :class:`ActionGroupsOperations` + * 2018-03-01: :class:`ActionGroupsOperations` + * 2018-09-01: :class:`ActionGroupsOperations` + * 2019-03-01: :class:`ActionGroupsOperations` + * 2019-06-01: :class:`ActionGroupsOperations` """ api_version = self._get_api_version('action_groups') if api_version == '2017-04-01': @@ -215,8 +223,8 @@ def action_groups(self): def activity_log_alerts(self): """Instance depends on the API version: - * 2017-03-01-preview: :class:`ActivityLogAlertsOperations` - * 2017-04-01: :class:`ActivityLogAlertsOperations` + * 2017-03-01-preview: :class:`ActivityLogAlertsOperations` + * 2017-04-01: :class:`ActivityLogAlertsOperations` """ api_version = self._get_api_version('activity_log_alerts') if api_version == '2017-03-01-preview': @@ -231,7 +239,7 @@ def activity_log_alerts(self): def activity_logs(self): """Instance depends on the API version: - * 2015-04-01: :class:`ActivityLogsOperations` + * 2015-04-01: :class:`ActivityLogsOperations` """ api_version = self._get_api_version('activity_logs') if api_version == '2015-04-01': @@ -244,7 +252,7 @@ def activity_logs(self): def alert_rule_incidents(self): """Instance depends on the API version: - * 2016-03-01: :class:`AlertRuleIncidentsOperations` + * 2016-03-01: :class:`AlertRuleIncidentsOperations` """ api_version = self._get_api_version('alert_rule_incidents') if api_version == '2016-03-01': @@ -257,7 +265,7 @@ def alert_rule_incidents(self): def alert_rules(self): """Instance depends on the API version: - * 2016-03-01: :class:`AlertRulesOperations` + * 2016-03-01: :class:`AlertRulesOperations` """ api_version = self._get_api_version('alert_rules') if api_version == '2016-03-01': @@ -270,7 +278,7 @@ def alert_rules(self): def autoscale_settings(self): """Instance depends on the API version: - * 2015-04-01: :class:`AutoscaleSettingsOperations` + * 2015-04-01: :class:`AutoscaleSettingsOperations` """ api_version = self._get_api_version('autoscale_settings') if api_version == '2015-04-01': @@ -283,7 +291,7 @@ def autoscale_settings(self): def baseline(self): """Instance depends on the API version: - * 2018-09-01: :class:`BaselineOperations` + * 2018-09-01: :class:`BaselineOperations` """ api_version = self._get_api_version('baseline') if api_version == '2018-09-01': @@ -296,7 +304,7 @@ def baseline(self): def baselines(self): """Instance depends on the API version: - * 2019-03-01: :class:`BaselinesOperations` + * 2019-03-01: :class:`BaselinesOperations` """ api_version = self._get_api_version('baselines') if api_version == '2019-03-01': @@ -305,11 +313,37 @@ def baselines(self): raise ValueError("API version {} does not have operation group 'baselines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def data_collection_rule_associations(self): + """Instance depends on the API version: + + * 2019-11-01-preview: :class:`DataCollectionRuleAssociationsOperations` + """ + api_version = self._get_api_version('data_collection_rule_associations') + if api_version == '2019-11-01-preview': + from .v2019_11_01_preview.operations import DataCollectionRuleAssociationsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'data_collection_rule_associations'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def data_collection_rules(self): + """Instance depends on the API version: + + * 2019-11-01-preview: :class:`DataCollectionRulesOperations` + """ + api_version = self._get_api_version('data_collection_rules') + if api_version == '2019-11-01-preview': + from .v2019_11_01_preview.operations import DataCollectionRulesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'data_collection_rules'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def diagnostic_settings(self): """Instance depends on the API version: - * 2017-05-01-preview: :class:`DiagnosticSettingsOperations` + * 2017-05-01-preview: :class:`DiagnosticSettingsOperations` """ api_version = self._get_api_version('diagnostic_settings') if api_version == '2017-05-01-preview': @@ -322,7 +356,7 @@ def diagnostic_settings(self): def diagnostic_settings_category(self): """Instance depends on the API version: - * 2017-05-01-preview: :class:`DiagnosticSettingsCategoryOperations` + * 2017-05-01-preview: :class:`DiagnosticSettingsCategoryOperations` """ api_version = self._get_api_version('diagnostic_settings_category') if api_version == '2017-05-01-preview': @@ -335,7 +369,7 @@ def diagnostic_settings_category(self): def event_categories(self): """Instance depends on the API version: - * 2015-04-01: :class:`EventCategoriesOperations` + * 2015-04-01: :class:`EventCategoriesOperations` """ api_version = self._get_api_version('event_categories') if api_version == '2015-04-01': @@ -348,7 +382,7 @@ def event_categories(self): def guest_diagnostics_settings(self): """Instance depends on the API version: - * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsOperations` + * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsOperations` """ api_version = self._get_api_version('guest_diagnostics_settings') if api_version == '2018-06-01-preview': @@ -361,7 +395,7 @@ def guest_diagnostics_settings(self): def guest_diagnostics_settings_association(self): """Instance depends on the API version: - * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsAssociationOperations` + * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsAssociationOperations` """ api_version = self._get_api_version('guest_diagnostics_settings_association') if api_version == '2018-06-01-preview': @@ -374,7 +408,7 @@ def guest_diagnostics_settings_association(self): def log_profiles(self): """Instance depends on the API version: - * 2016-03-01: :class:`LogProfilesOperations` + * 2016-03-01: :class:`LogProfilesOperations` """ api_version = self._get_api_version('log_profiles') if api_version == '2016-03-01': @@ -387,7 +421,7 @@ def log_profiles(self): def management_group_diagnostic_settings(self): """Instance depends on the API version: - * 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` + * 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` """ api_version = self._get_api_version('management_group_diagnostic_settings') if api_version == '2020-01-01-preview': @@ -400,7 +434,7 @@ def management_group_diagnostic_settings(self): def metric_alerts(self): """Instance depends on the API version: - * 2018-03-01: :class:`MetricAlertsOperations` + * 2018-03-01: :class:`MetricAlertsOperations` """ api_version = self._get_api_version('metric_alerts') if api_version == '2018-03-01': @@ -413,7 +447,7 @@ def metric_alerts(self): def metric_alerts_status(self): """Instance depends on the API version: - * 2018-03-01: :class:`MetricAlertsStatusOperations` + * 2018-03-01: :class:`MetricAlertsStatusOperations` """ api_version = self._get_api_version('metric_alerts_status') if api_version == '2018-03-01': @@ -426,8 +460,8 @@ def metric_alerts_status(self): def metric_baseline(self): """Instance depends on the API version: - * 2017-11-01-preview: :class:`MetricBaselineOperations` - * 2018-09-01: :class:`MetricBaselineOperations` + * 2017-11-01-preview: :class:`MetricBaselineOperations` + * 2018-09-01: :class:`MetricBaselineOperations` """ api_version = self._get_api_version('metric_baseline') if api_version == '2017-11-01-preview': @@ -442,9 +476,9 @@ def metric_baseline(self): def metric_definitions(self): """Instance depends on the API version: - * 2016-03-01: :class:`MetricDefinitionsOperations` - * 2017-05-01-preview: :class:`MetricDefinitionsOperations` - * 2018-01-01: :class:`MetricDefinitionsOperations` + * 2016-03-01: :class:`MetricDefinitionsOperations` + * 2017-05-01-preview: :class:`MetricDefinitionsOperations` + * 2018-01-01: :class:`MetricDefinitionsOperations` """ api_version = self._get_api_version('metric_definitions') if api_version == '2016-03-01': @@ -461,7 +495,7 @@ def metric_definitions(self): def metric_namespaces(self): """Instance depends on the API version: - * 2017-12-01-preview: :class:`MetricNamespacesOperations` + * 2017-12-01-preview: :class:`MetricNamespacesOperations` """ api_version = self._get_api_version('metric_namespaces') if api_version == '2017-12-01-preview': @@ -474,9 +508,9 @@ def metric_namespaces(self): def metrics(self): """Instance depends on the API version: - * 2016-09-01: :class:`MetricsOperations` - * 2017-05-01-preview: :class:`MetricsOperations` - * 2018-01-01: :class:`MetricsOperations` + * 2016-09-01: :class:`MetricsOperations` + * 2017-05-01-preview: :class:`MetricsOperations` + * 2018-01-01: :class:`MetricsOperations` """ api_version = self._get_api_version('metrics') if api_version == '2016-09-01': @@ -493,7 +527,7 @@ def metrics(self): def operations(self): """Instance depends on the API version: - * 2015-04-01: :class:`Operations` + * 2015-04-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-04-01': @@ -506,7 +540,7 @@ def operations(self): def private_endpoint_connections(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateEndpointConnectionsOperations` + * 2019-10-17-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2019-10-17-preview': @@ -519,7 +553,7 @@ def private_endpoint_connections(self): def private_link_resources(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateLinkResourcesOperations` + * 2019-10-17-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2019-10-17-preview': @@ -532,7 +566,7 @@ def private_link_resources(self): def private_link_scope_operation_status(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateLinkScopeOperationStatusOperations` + * 2019-10-17-preview: :class:`PrivateLinkScopeOperationStatusOperations` """ api_version = self._get_api_version('private_link_scope_operation_status') if api_version == '2019-10-17-preview': @@ -545,7 +579,7 @@ def private_link_scope_operation_status(self): def private_link_scoped_resources(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateLinkScopedResourcesOperations` + * 2019-10-17-preview: :class:`PrivateLinkScopedResourcesOperations` """ api_version = self._get_api_version('private_link_scoped_resources') if api_version == '2019-10-17-preview': @@ -558,7 +592,7 @@ def private_link_scoped_resources(self): def private_link_scopes(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateLinkScopesOperations` + * 2019-10-17-preview: :class:`PrivateLinkScopesOperations` """ api_version = self._get_api_version('private_link_scopes') if api_version == '2019-10-17-preview': @@ -571,11 +605,14 @@ def private_link_scopes(self): def scheduled_query_rules(self): """Instance depends on the API version: - * 2018-04-16: :class:`ScheduledQueryRulesOperations` + * 2018-04-16: :class:`ScheduledQueryRulesOperations` + * 2020-05-01-preview: :class:`ScheduledQueryRulesOperations` """ api_version = self._get_api_version('scheduled_query_rules') if api_version == '2018-04-16': from .v2018_04_16.operations import ScheduledQueryRulesOperations as OperationClass + elif api_version == '2020-05-01-preview': + from .v2020_05_01_preview.operations import ScheduledQueryRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'scheduled_query_rules'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -584,8 +621,8 @@ def scheduled_query_rules(self): def service_diagnostic_settings(self): """Instance depends on the API version: - * 2015-07-01: :class:`ServiceDiagnosticSettingsOperations` - * 2016-09-01: :class:`ServiceDiagnosticSettingsOperations` + * 2015-07-01: :class:`ServiceDiagnosticSettingsOperations` + * 2016-09-01: :class:`ServiceDiagnosticSettingsOperations` """ api_version = self._get_api_version('service_diagnostic_settings') if api_version == '2015-07-01': @@ -600,7 +637,7 @@ def service_diagnostic_settings(self): def subscription_diagnostic_settings(self): """Instance depends on the API version: - * 2017-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` + * 2017-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` """ api_version = self._get_api_version('subscription_diagnostic_settings') if api_version == '2017-05-01-preview': @@ -613,7 +650,7 @@ def subscription_diagnostic_settings(self): def tenant_activity_logs(self): """Instance depends on the API version: - * 2015-04-01: :class:`TenantActivityLogsOperations` + * 2015-04-01: :class:`TenantActivityLogsOperations` """ api_version = self._get_api_version('tenant_activity_logs') if api_version == '2015-04-01': @@ -626,7 +663,7 @@ def tenant_activity_logs(self): def vm_insights(self): """Instance depends on the API version: - * 2018-11-27-preview: :class:`VMInsightsOperations` + * 2018-11-27-preview: :class:`VMInsightsOperations` """ api_version = self._get_api_version('vm_insights') if api_version == '2018-11-27-preview': diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py index fe15f823d1a5a..a68fd941da58a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py @@ -25,7 +25,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -44,7 +44,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client.py index 0eee1823d96ec..43f1e9c9b8efb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client.py @@ -36,7 +36,7 @@ class MonitorClient(MultiApiClientMixin, _SDKClient): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str api_version: API version to use if no profile is provided, or if missing in profile. @@ -47,7 +47,7 @@ class MonitorClient(MultiApiClientMixin, _SDKClient): """ DEFAULT_API_VERSION = '2019-10-17-preview' - _PROFILE_TAG = "azure.mgmt.eventhub.MonitorClient" + _PROFILE_TAG = "azure.mgmt.monitor.MonitorClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, @@ -107,25 +107,27 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: - * 2015-04-01: :mod:`v2015_04_01.models` - * 2015-07-01: :mod:`v2015_07_01.models` - * 2016-03-01: :mod:`v2016_03_01.models` - * 2016-09-01: :mod:`v2016_09_01.models` - * 2017-03-01-preview: :mod:`v2017_03_01_preview.models` - * 2017-04-01: :mod:`v2017_04_01.models` - * 2017-05-01-preview: :mod:`v2017_05_01_preview.models` - * 2017-11-01-preview: :mod:`v2017_11_01_preview.models` - * 2017-12-01-preview: :mod:`v2017_12_01_preview.models` - * 2018-01-01: :mod:`v2018_01_01.models` - * 2018-03-01: :mod:`v2018_03_01.models` - * 2018-04-16: :mod:`v2018_04_16.models` - * 2018-06-01-preview: :mod:`v2018_06_01_preview.models` - * 2018-09-01: :mod:`v2018_09_01.models` - * 2018-11-27-preview: :mod:`v2018_11_27_preview.models` - * 2019-03-01: :mod:`v2019_03_01.models` - * 2019-06-01: :mod:`v2019_06_01.models` - * 2019-10-17-preview: :mod:`v2019_10_17.models` - * 2020-01-01-preview: :mod:`v2020_01_01_preview.models` + * 2015-04-01: :mod:`v2015_04_01.models` + * 2015-07-01: :mod:`v2015_07_01.models` + * 2016-03-01: :mod:`v2016_03_01.models` + * 2016-09-01: :mod:`v2016_09_01.models` + * 2017-03-01-preview: :mod:`v2017_03_01_preview.models` + * 2017-04-01: :mod:`v2017_04_01.models` + * 2017-05-01-preview: :mod:`v2017_05_01_preview.models` + * 2017-11-01-preview: :mod:`v2017_11_01_preview.models` + * 2017-12-01-preview: :mod:`v2017_12_01_preview.models` + * 2018-01-01: :mod:`v2018_01_01.models` + * 2018-03-01: :mod:`v2018_03_01.models` + * 2018-04-16: :mod:`v2018_04_16.models` + * 2018-06-01-preview: :mod:`v2018_06_01_preview.models` + * 2018-09-01: :mod:`v2018_09_01.models` + * 2018-11-27-preview: :mod:`v2018_11_27_preview.models` + * 2019-03-01: :mod:`v2019_03_01.models` + * 2019-06-01: :mod:`v2019_06_01.models` + * 2019-10-17-preview: :mod:`v2019_10_17.models` + * 2019-11-01-preview: :mod:`v2019_11_01_preview.models` + * 2020-01-01-preview: :mod:`v2020_01_01_preview.models` + * 2020-05-01-preview: :mod:`v2020_05_01_preview.models` """ if api_version == '2015-04-01': from ..v2015_04_01 import models @@ -181,20 +183,26 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-10-17-preview': from ..v2019_10_17 import models return models + elif api_version == '2019-11-01-preview': + from ..v2019_11_01_preview import models + return models elif api_version == '2020-01-01-preview': from ..v2020_01_01_preview import models return models + elif api_version == '2020-05-01-preview': + from ..v2020_05_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property def action_groups(self): """Instance depends on the API version: - * 2017-04-01: :class:`ActionGroupsOperations` - * 2018-03-01: :class:`ActionGroupsOperations` - * 2018-09-01: :class:`ActionGroupsOperations` - * 2019-03-01: :class:`ActionGroupsOperations` - * 2019-06-01: :class:`ActionGroupsOperations` + * 2017-04-01: :class:`ActionGroupsOperations` + * 2018-03-01: :class:`ActionGroupsOperations` + * 2018-09-01: :class:`ActionGroupsOperations` + * 2019-03-01: :class:`ActionGroupsOperations` + * 2019-06-01: :class:`ActionGroupsOperations` """ api_version = self._get_api_version('action_groups') if api_version == '2017-04-01': @@ -215,8 +223,8 @@ def action_groups(self): def activity_log_alerts(self): """Instance depends on the API version: - * 2017-03-01-preview: :class:`ActivityLogAlertsOperations` - * 2017-04-01: :class:`ActivityLogAlertsOperations` + * 2017-03-01-preview: :class:`ActivityLogAlertsOperations` + * 2017-04-01: :class:`ActivityLogAlertsOperations` """ api_version = self._get_api_version('activity_log_alerts') if api_version == '2017-03-01-preview': @@ -231,7 +239,7 @@ def activity_log_alerts(self): def activity_logs(self): """Instance depends on the API version: - * 2015-04-01: :class:`ActivityLogsOperations` + * 2015-04-01: :class:`ActivityLogsOperations` """ api_version = self._get_api_version('activity_logs') if api_version == '2015-04-01': @@ -244,7 +252,7 @@ def activity_logs(self): def alert_rule_incidents(self): """Instance depends on the API version: - * 2016-03-01: :class:`AlertRuleIncidentsOperations` + * 2016-03-01: :class:`AlertRuleIncidentsOperations` """ api_version = self._get_api_version('alert_rule_incidents') if api_version == '2016-03-01': @@ -257,7 +265,7 @@ def alert_rule_incidents(self): def alert_rules(self): """Instance depends on the API version: - * 2016-03-01: :class:`AlertRulesOperations` + * 2016-03-01: :class:`AlertRulesOperations` """ api_version = self._get_api_version('alert_rules') if api_version == '2016-03-01': @@ -270,7 +278,7 @@ def alert_rules(self): def autoscale_settings(self): """Instance depends on the API version: - * 2015-04-01: :class:`AutoscaleSettingsOperations` + * 2015-04-01: :class:`AutoscaleSettingsOperations` """ api_version = self._get_api_version('autoscale_settings') if api_version == '2015-04-01': @@ -283,7 +291,7 @@ def autoscale_settings(self): def baseline(self): """Instance depends on the API version: - * 2018-09-01: :class:`BaselineOperations` + * 2018-09-01: :class:`BaselineOperations` """ api_version = self._get_api_version('baseline') if api_version == '2018-09-01': @@ -296,7 +304,7 @@ def baseline(self): def baselines(self): """Instance depends on the API version: - * 2019-03-01: :class:`BaselinesOperations` + * 2019-03-01: :class:`BaselinesOperations` """ api_version = self._get_api_version('baselines') if api_version == '2019-03-01': @@ -305,11 +313,37 @@ def baselines(self): raise ValueError("API version {} does not have operation group 'baselines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def data_collection_rule_associations(self): + """Instance depends on the API version: + + * 2019-11-01-preview: :class:`DataCollectionRuleAssociationsOperations` + """ + api_version = self._get_api_version('data_collection_rule_associations') + if api_version == '2019-11-01-preview': + from ..v2019_11_01_preview.aio.operations import DataCollectionRuleAssociationsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'data_collection_rule_associations'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def data_collection_rules(self): + """Instance depends on the API version: + + * 2019-11-01-preview: :class:`DataCollectionRulesOperations` + """ + api_version = self._get_api_version('data_collection_rules') + if api_version == '2019-11-01-preview': + from ..v2019_11_01_preview.aio.operations import DataCollectionRulesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'data_collection_rules'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def diagnostic_settings(self): """Instance depends on the API version: - * 2017-05-01-preview: :class:`DiagnosticSettingsOperations` + * 2017-05-01-preview: :class:`DiagnosticSettingsOperations` """ api_version = self._get_api_version('diagnostic_settings') if api_version == '2017-05-01-preview': @@ -322,7 +356,7 @@ def diagnostic_settings(self): def diagnostic_settings_category(self): """Instance depends on the API version: - * 2017-05-01-preview: :class:`DiagnosticSettingsCategoryOperations` + * 2017-05-01-preview: :class:`DiagnosticSettingsCategoryOperations` """ api_version = self._get_api_version('diagnostic_settings_category') if api_version == '2017-05-01-preview': @@ -335,7 +369,7 @@ def diagnostic_settings_category(self): def event_categories(self): """Instance depends on the API version: - * 2015-04-01: :class:`EventCategoriesOperations` + * 2015-04-01: :class:`EventCategoriesOperations` """ api_version = self._get_api_version('event_categories') if api_version == '2015-04-01': @@ -348,7 +382,7 @@ def event_categories(self): def guest_diagnostics_settings(self): """Instance depends on the API version: - * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsOperations` + * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsOperations` """ api_version = self._get_api_version('guest_diagnostics_settings') if api_version == '2018-06-01-preview': @@ -361,7 +395,7 @@ def guest_diagnostics_settings(self): def guest_diagnostics_settings_association(self): """Instance depends on the API version: - * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsAssociationOperations` + * 2018-06-01-preview: :class:`GuestDiagnosticsSettingsAssociationOperations` """ api_version = self._get_api_version('guest_diagnostics_settings_association') if api_version == '2018-06-01-preview': @@ -374,7 +408,7 @@ def guest_diagnostics_settings_association(self): def log_profiles(self): """Instance depends on the API version: - * 2016-03-01: :class:`LogProfilesOperations` + * 2016-03-01: :class:`LogProfilesOperations` """ api_version = self._get_api_version('log_profiles') if api_version == '2016-03-01': @@ -387,7 +421,7 @@ def log_profiles(self): def management_group_diagnostic_settings(self): """Instance depends on the API version: - * 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` + * 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` """ api_version = self._get_api_version('management_group_diagnostic_settings') if api_version == '2020-01-01-preview': @@ -400,7 +434,7 @@ def management_group_diagnostic_settings(self): def metric_alerts(self): """Instance depends on the API version: - * 2018-03-01: :class:`MetricAlertsOperations` + * 2018-03-01: :class:`MetricAlertsOperations` """ api_version = self._get_api_version('metric_alerts') if api_version == '2018-03-01': @@ -413,7 +447,7 @@ def metric_alerts(self): def metric_alerts_status(self): """Instance depends on the API version: - * 2018-03-01: :class:`MetricAlertsStatusOperations` + * 2018-03-01: :class:`MetricAlertsStatusOperations` """ api_version = self._get_api_version('metric_alerts_status') if api_version == '2018-03-01': @@ -426,8 +460,8 @@ def metric_alerts_status(self): def metric_baseline(self): """Instance depends on the API version: - * 2017-11-01-preview: :class:`MetricBaselineOperations` - * 2018-09-01: :class:`MetricBaselineOperations` + * 2017-11-01-preview: :class:`MetricBaselineOperations` + * 2018-09-01: :class:`MetricBaselineOperations` """ api_version = self._get_api_version('metric_baseline') if api_version == '2017-11-01-preview': @@ -442,9 +476,9 @@ def metric_baseline(self): def metric_definitions(self): """Instance depends on the API version: - * 2016-03-01: :class:`MetricDefinitionsOperations` - * 2017-05-01-preview: :class:`MetricDefinitionsOperations` - * 2018-01-01: :class:`MetricDefinitionsOperations` + * 2016-03-01: :class:`MetricDefinitionsOperations` + * 2017-05-01-preview: :class:`MetricDefinitionsOperations` + * 2018-01-01: :class:`MetricDefinitionsOperations` """ api_version = self._get_api_version('metric_definitions') if api_version == '2016-03-01': @@ -461,7 +495,7 @@ def metric_definitions(self): def metric_namespaces(self): """Instance depends on the API version: - * 2017-12-01-preview: :class:`MetricNamespacesOperations` + * 2017-12-01-preview: :class:`MetricNamespacesOperations` """ api_version = self._get_api_version('metric_namespaces') if api_version == '2017-12-01-preview': @@ -474,9 +508,9 @@ def metric_namespaces(self): def metrics(self): """Instance depends on the API version: - * 2016-09-01: :class:`MetricsOperations` - * 2017-05-01-preview: :class:`MetricsOperations` - * 2018-01-01: :class:`MetricsOperations` + * 2016-09-01: :class:`MetricsOperations` + * 2017-05-01-preview: :class:`MetricsOperations` + * 2018-01-01: :class:`MetricsOperations` """ api_version = self._get_api_version('metrics') if api_version == '2016-09-01': @@ -493,7 +527,7 @@ def metrics(self): def operations(self): """Instance depends on the API version: - * 2015-04-01: :class:`Operations` + * 2015-04-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-04-01': @@ -506,7 +540,7 @@ def operations(self): def private_endpoint_connections(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateEndpointConnectionsOperations` + * 2019-10-17-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2019-10-17-preview': @@ -519,7 +553,7 @@ def private_endpoint_connections(self): def private_link_resources(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateLinkResourcesOperations` + * 2019-10-17-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2019-10-17-preview': @@ -532,7 +566,7 @@ def private_link_resources(self): def private_link_scope_operation_status(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateLinkScopeOperationStatusOperations` + * 2019-10-17-preview: :class:`PrivateLinkScopeOperationStatusOperations` """ api_version = self._get_api_version('private_link_scope_operation_status') if api_version == '2019-10-17-preview': @@ -545,7 +579,7 @@ def private_link_scope_operation_status(self): def private_link_scoped_resources(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateLinkScopedResourcesOperations` + * 2019-10-17-preview: :class:`PrivateLinkScopedResourcesOperations` """ api_version = self._get_api_version('private_link_scoped_resources') if api_version == '2019-10-17-preview': @@ -558,7 +592,7 @@ def private_link_scoped_resources(self): def private_link_scopes(self): """Instance depends on the API version: - * 2019-10-17-preview: :class:`PrivateLinkScopesOperations` + * 2019-10-17-preview: :class:`PrivateLinkScopesOperations` """ api_version = self._get_api_version('private_link_scopes') if api_version == '2019-10-17-preview': @@ -571,11 +605,14 @@ def private_link_scopes(self): def scheduled_query_rules(self): """Instance depends on the API version: - * 2018-04-16: :class:`ScheduledQueryRulesOperations` + * 2018-04-16: :class:`ScheduledQueryRulesOperations` + * 2020-05-01-preview: :class:`ScheduledQueryRulesOperations` """ api_version = self._get_api_version('scheduled_query_rules') if api_version == '2018-04-16': from ..v2018_04_16.aio.operations import ScheduledQueryRulesOperations as OperationClass + elif api_version == '2020-05-01-preview': + from ..v2020_05_01_preview.aio.operations import ScheduledQueryRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'scheduled_query_rules'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -584,8 +621,8 @@ def scheduled_query_rules(self): def service_diagnostic_settings(self): """Instance depends on the API version: - * 2015-07-01: :class:`ServiceDiagnosticSettingsOperations` - * 2016-09-01: :class:`ServiceDiagnosticSettingsOperations` + * 2015-07-01: :class:`ServiceDiagnosticSettingsOperations` + * 2016-09-01: :class:`ServiceDiagnosticSettingsOperations` """ api_version = self._get_api_version('service_diagnostic_settings') if api_version == '2015-07-01': @@ -600,7 +637,7 @@ def service_diagnostic_settings(self): def subscription_diagnostic_settings(self): """Instance depends on the API version: - * 2017-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` + * 2017-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` """ api_version = self._get_api_version('subscription_diagnostic_settings') if api_version == '2017-05-01-preview': @@ -613,7 +650,7 @@ def subscription_diagnostic_settings(self): def tenant_activity_logs(self): """Instance depends on the API version: - * 2015-04-01: :class:`TenantActivityLogsOperations` + * 2015-04-01: :class:`TenantActivityLogsOperations` """ api_version = self._get_api_version('tenant_activity_logs') if api_version == '2015-04-01': @@ -626,7 +663,7 @@ def tenant_activity_logs(self): def vm_insights(self): """Instance depends on the API version: - * 2018-11-27-preview: :class:`VMInsightsOperations` + * 2018-11-27-preview: :class:`VMInsightsOperations` """ api_version = self._get_api_version('vm_insights') if api_version == '2018-11-27-preview': diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py index bf2db0f8d6c66..bf4698ba79a3b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2015-04-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json index ac34301c5de6f..d46b2edbf195e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_client.py index ad2470ff3b5c8..563fad485082e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_client.py @@ -41,7 +41,7 @@ class MonitorClient(object): :vartype tenant_activity_logs: $(python-base-namespace).v2015_04_01.operations.TenantActivityLogsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -61,7 +61,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.activity_logs = ActivityLogsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py index 4ea79ca49ff1e..3eaf57800886d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2015-04-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_client.py index aa50723752636..bc3c4f4c833cf 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_client.py @@ -39,7 +39,7 @@ class MonitorClient(object): :vartype tenant_activity_logs: $(python-base-namespace).v2015_04_01.aio.operations.TenantActivityLogsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -58,7 +58,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.activity_logs = ActivityLogsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py index 23732a644d20f..6bd1f93be7424 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ActivityLogsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def list( filter: str, select: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.EventDataCollection"]: + ) -> AsyncIterable["_models.EventDataCollection"]: """Provides the list of records from the activity logs. :param filter: Reduces the set of data collected.:code:`
`This argument is required and it @@ -77,7 +77,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.EventDataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EventDataCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventDataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -94,7 +94,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -125,7 +125,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py index 6f9308cb76168..ea56e5280661a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class AutoscaleSettingsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.AutoscaleSettingResourceCollection"]: + ) -> AsyncIterable["_models.AutoscaleSettingResourceCollection"]: """Lists the autoscale settings for a resource group. :param resource_group_name: The name of the resource group. @@ -55,7 +55,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -73,7 +73,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -101,7 +101,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -116,9 +116,9 @@ async def create_or_update( self, resource_group_name: str, autoscale_setting_name: str, - parameters: "models.AutoscaleSettingResource", + parameters: "_models.AutoscaleSettingResource", **kwargs - ) -> "models.AutoscaleSettingResource": + ) -> "_models.AutoscaleSettingResource": """Creates or updates an autoscale setting. :param resource_group_name: The name of the resource group. @@ -132,7 +132,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -146,7 +146,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -168,7 +168,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -213,7 +213,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -231,7 +231,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -244,7 +244,7 @@ async def get( resource_group_name: str, autoscale_setting_name: str, **kwargs - ) -> "models.AutoscaleSettingResource": + ) -> "_models.AutoscaleSettingResource": """Gets an autoscale setting. :param resource_group_name: The name of the resource group. @@ -256,7 +256,7 @@ async def get( :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -269,7 +269,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -287,7 +287,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -302,9 +302,9 @@ async def update( self, resource_group_name: str, autoscale_setting_name: str, - autoscale_setting_resource: "models.AutoscaleSettingResourcePatch", + autoscale_setting_resource: "_models.AutoscaleSettingResourcePatch", **kwargs - ) -> "models.AutoscaleSettingResource": + ) -> "_models.AutoscaleSettingResource": """Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. @@ -319,7 +319,7 @@ async def update( :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,7 +331,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), } @@ -355,7 +355,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -369,7 +369,7 @@ async def update( def list_by_subscription( self, **kwargs - ) -> AsyncIterable["models.AutoscaleSettingResourceCollection"]: + ) -> AsyncIterable["_models.AutoscaleSettingResourceCollection"]: """Lists the autoscale settings for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -377,7 +377,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -394,7 +394,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -422,7 +422,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py index 2d89bb1788a95..5ec63467bb153 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class EventCategoriesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.EventCategoryCollection"]: + ) -> AsyncIterable["_models.EventCategoryCollection"]: """Get the list of available event categories supported in the Activity Logs Service.:code:`
`The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. @@ -54,7 +54,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.EventCategoryCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EventCategoryCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventCategoryCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -95,7 +95,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py index e7b2c8a4ab239..ba5eac551697d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def list( self, **kwargs - ) -> "models.OperationListResult": + ) -> "_models.OperationListResult": """Lists all of the available operations from Microsoft.Insights provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -51,7 +51,7 @@ async def list( :rtype: ~$(python-base-namespace).v2015_04_01.models.OperationListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py index ccc43fec7b3ab..605d7a793407d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TenantActivityLogsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def list( filter: Optional[str] = None, select: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.EventDataCollection"]: + ) -> AsyncIterable["_models.EventDataCollection"]: """Gets the Activity Logs for the Tenant.:code:`
`Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).:code:`
`One thing to point out here is that this API does *not* retrieve the logs at @@ -81,7 +81,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.EventDataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EventDataCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventDataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -126,7 +126,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py index 8a391fdfaba6d..e03482cbb90b8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ActivityLogsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( select=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.EventDataCollection"] + # type: (...) -> Iterable["_models.EventDataCollection"] """Provides the list of records from the activity logs. :param filter: Reduces the set of data collected.:code:`
`This argument is required and it @@ -82,7 +82,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.EventDataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EventDataCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventDataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -130,7 +130,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py index 3a8c481762d8a..a313979a04956 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class AutoscaleSettingsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.AutoscaleSettingResourceCollection"] + # type: (...) -> Iterable["_models.AutoscaleSettingResourceCollection"] """Lists the autoscale settings for a resource group. :param resource_group_name: The name of the resource group. @@ -60,7 +60,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -78,7 +78,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -106,7 +106,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -121,10 +121,10 @@ def create_or_update( self, resource_group_name, # type: str autoscale_setting_name, # type: str - parameters, # type: "models.AutoscaleSettingResource" + parameters, # type: "_models.AutoscaleSettingResource" **kwargs # type: Any ): - # type: (...) -> "models.AutoscaleSettingResource" + # type: (...) -> "_models.AutoscaleSettingResource" """Creates or updates an autoscale setting. :param resource_group_name: The name of the resource group. @@ -138,7 +138,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -152,7 +152,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -174,7 +174,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -220,7 +220,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -238,7 +238,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -252,7 +252,7 @@ def get( autoscale_setting_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.AutoscaleSettingResource" + # type: (...) -> "_models.AutoscaleSettingResource" """Gets an autoscale setting. :param resource_group_name: The name of the resource group. @@ -264,7 +264,7 @@ def get( :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -277,7 +277,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -295,7 +295,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -310,10 +310,10 @@ def update( self, resource_group_name, # type: str autoscale_setting_name, # type: str - autoscale_setting_resource, # type: "models.AutoscaleSettingResourcePatch" + autoscale_setting_resource, # type: "_models.AutoscaleSettingResourcePatch" **kwargs # type: Any ): - # type: (...) -> "models.AutoscaleSettingResource" + # type: (...) -> "_models.AutoscaleSettingResource" """Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. @@ -328,7 +328,7 @@ def update( :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -340,7 +340,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), } @@ -364,7 +364,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -379,7 +379,7 @@ def list_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.AutoscaleSettingResourceCollection"] + # type: (...) -> Iterable["_models.AutoscaleSettingResourceCollection"] """Lists the autoscale settings for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -387,7 +387,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AutoscaleSettingResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -404,7 +404,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -432,7 +432,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py index 1ee3dc853cc28..a694d451cfc9e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class EventCategoriesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.EventCategoryCollection"] + # type: (...) -> Iterable["_models.EventCategoryCollection"] """Get the list of available event categories supported in the Activity Logs Service.:code:`
`The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. @@ -59,7 +59,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.EventCategoryCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EventCategoryCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventCategoryCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -100,7 +100,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py index 97f40d98c276d..6135ddd2958a4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,7 +48,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "models.OperationListResult" + # type: (...) -> "_models.OperationListResult" """Lists all of the available operations from Microsoft.Insights provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -56,7 +56,7 @@ def list( :rtype: ~$(python-base-namespace).v2015_04_01.models.OperationListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py index 63bddb7997c68..b16eb54262917 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TenantActivityLogsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( select=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.EventDataCollection"] + # type: (...) -> Iterable["_models.EventDataCollection"] """Gets the Activity Logs for the Tenant.:code:`
`Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).:code:`
`One thing to point out here is that this API does *not* retrieve the logs at @@ -86,7 +86,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.EventDataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EventDataCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventDataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -131,7 +131,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py index 8caff7d56cc6b..4f0397e71c6c2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py @@ -43,7 +43,7 @@ def __init__( self.credential = credential self.api_version = "2015-07-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json index a1b4338f57bb0..bf81eebe53ac9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_client.py index 5e9c7e79f9fc0..6c1e840624425 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_client.py @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py index 5ab782355f001..c960e2b756140 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py @@ -40,7 +40,7 @@ def __init__( self.credential = credential self.api_version = "2015-07-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_client.py index 769c111b861aa..6d9cad39ce90c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_client.py @@ -43,7 +43,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py index a0b7bc888b530..6032168120e40 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class ServiceDiagnosticSettingsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ async def get( self, resource_uri: str, **kwargs - ) -> "models.ServiceDiagnosticSettingsResource": + ) -> "_models.ServiceDiagnosticSettingsResource": """Gets the active diagnostic settings for the specified resource. :param resource_uri: The identifier of the resource. @@ -54,7 +54,7 @@ async def get( :rtype: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -83,7 +83,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) @@ -97,9 +97,9 @@ async def get( async def create_or_update( self, resource_uri: str, - parameters: "models.ServiceDiagnosticSettingsResource", + parameters: "_models.ServiceDiagnosticSettingsResource", **kwargs - ) -> "models.ServiceDiagnosticSettingsResource": + ) -> "_models.ServiceDiagnosticSettingsResource": """Create or update new diagnostic settings for the specified resource. :param resource_uri: The identifier of the resource. @@ -111,7 +111,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py index 34b3c8e99fd8e..b5d62a28a5325 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class ServiceDiagnosticSettingsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def get( resource_uri, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ServiceDiagnosticSettingsResource" + # type: (...) -> "_models.ServiceDiagnosticSettingsResource" """Gets the active diagnostic settings for the specified resource. :param resource_uri: The identifier of the resource. @@ -59,7 +59,7 @@ def get( :rtype: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -88,7 +88,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) @@ -102,10 +102,10 @@ def get( def create_or_update( self, resource_uri, # type: str - parameters, # type: "models.ServiceDiagnosticSettingsResource" + parameters, # type: "_models.ServiceDiagnosticSettingsResource" **kwargs # type: Any ): - # type: (...) -> "models.ServiceDiagnosticSettingsResource" + # type: (...) -> "_models.ServiceDiagnosticSettingsResource" """Create or update new diagnostic settings for the specified resource. :param resource_uri: The identifier of the resource. @@ -117,7 +117,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py index 49690a03aabb5..f4891a9af5f63 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2016-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json index e835b0d273c5b..c59aaa7a1174c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_client.py index bdaa636693450..5a41cf46428c6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_client.py @@ -38,7 +38,7 @@ class MonitorClient(object): :vartype metric_definitions: $(python-base-namespace).v2016_03_01.operations.MetricDefinitionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -58,7 +58,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.alert_rule_incidents = AlertRuleIncidentsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py index b656b9a5b462f..b40e218cff256 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2016-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_client.py index b4decfae27d65..980330bd826fc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_client.py @@ -36,7 +36,7 @@ class MonitorClient(object): :vartype metric_definitions: $(python-base-namespace).v2016_03_01.aio.operations.MetricDefinitionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -55,7 +55,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.alert_rule_incidents = AlertRuleIncidentsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py index bb6896d7def24..e023fd1718e10 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class AlertRuleIncidentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get( rule_name: str, incident_name: str, **kwargs - ) -> "models.Incident": + ) -> "_models.Incident": """Gets an incident associated to an alert rule. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def get( :rtype: ~$(python-base-namespace).v2016_03_01.models.Incident :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Incident"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -75,7 +75,7 @@ async def get( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), 'incidentName': self._serialize.url("incident_name", incident_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Incident', pipeline_response) @@ -109,7 +109,7 @@ def list_by_alert_rule( resource_group_name: str, rule_name: str, **kwargs - ) -> AsyncIterable["models.IncidentListResult"]: + ) -> AsyncIterable["_models.IncidentListResult"]: """Gets a list of incidents associated to an alert rule. :param resource_group_name: The name of the resource group. @@ -121,7 +121,7 @@ def list_by_alert_rule( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.IncidentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -140,7 +140,7 @@ def prepare_request(next_link=None): path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py index 7c88bc63ec653..6ec71aeb8cd48 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class AlertRulesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, rule_name: str, - parameters: "models.AlertRuleResource", + parameters: "_models.AlertRuleResource", **kwargs - ) -> "models.AlertRuleResource": + ) -> "_models.AlertRuleResource": """Creates or updates a classic metric alert rule. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2016_03_01.models.AlertRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -141,7 +141,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -170,7 +170,7 @@ async def get( resource_group_name: str, rule_name: str, **kwargs - ) -> "models.AlertRuleResource": + ) -> "_models.AlertRuleResource": """Gets a classic metric alert rule. :param resource_group_name: The name of the resource group. @@ -182,7 +182,7 @@ async def get( :rtype: ~$(python-base-namespace).v2016_03_01.models.AlertRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -195,7 +195,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -227,9 +227,9 @@ async def update( self, resource_group_name: str, rule_name: str, - alert_rules_resource: "models.AlertRuleResourcePatch", + alert_rules_resource: "_models.AlertRuleResourcePatch", **kwargs - ) -> "models.AlertRuleResource": + ) -> "_models.AlertRuleResource": """Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. @@ -244,7 +244,7 @@ async def update( :rtype: ~$(python-base-namespace).v2016_03_01.models.AlertRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -256,7 +256,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -280,7 +280,7 @@ async def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -299,7 +299,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.AlertRuleResourceCollection"]: + ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: """List the classic metric alert rules within a resource group. :param resource_group_name: The name of the resource group. @@ -309,7 +309,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -327,7 +327,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -368,7 +368,7 @@ async def get_next(next_link=None): def list_by_subscription( self, **kwargs - ) -> AsyncIterable["models.AlertRuleResourceCollection"]: + ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: """List the classic metric alert rules within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -376,7 +376,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,7 +393,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py index c8d95ea6e0798..500370642e6b1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class LogProfilesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -66,7 +66,7 @@ async def delete( url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -94,7 +94,7 @@ async def get( self, log_profile_name: str, **kwargs - ) -> "models.LogProfileResource": + ) -> "_models.LogProfileResource": """Gets the log profile. :param log_profile_name: The name of the log profile. @@ -104,7 +104,7 @@ async def get( :rtype: ~$(python-base-namespace).v2016_03_01.models.LogProfileResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogProfileResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -116,7 +116,7 @@ async def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -134,7 +134,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogProfileResource', pipeline_response) @@ -148,9 +148,9 @@ async def get( async def create_or_update( self, log_profile_name: str, - parameters: "models.LogProfileResource", + parameters: "_models.LogProfileResource", **kwargs - ) -> "models.LogProfileResource": + ) -> "_models.LogProfileResource": """Create or update a log profile in Azure Monitoring REST API. :param log_profile_name: The name of the log profile. @@ -162,7 +162,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2016_03_01.models.LogProfileResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogProfileResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -175,7 +175,7 @@ async def create_or_update( url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -210,9 +210,9 @@ async def create_or_update( async def update( self, log_profile_name: str, - log_profiles_resource: "models.LogProfileResourcePatch", + log_profiles_resource: "_models.LogProfileResourcePatch", **kwargs - ) -> "models.LogProfileResource": + ) -> "_models.LogProfileResource": """Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. :param log_profile_name: The name of the log profile. @@ -224,7 +224,7 @@ async def update( :rtype: ~$(python-base-namespace).v2016_03_01.models.LogProfileResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogProfileResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -236,7 +236,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -259,7 +259,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogProfileResource', pipeline_response) @@ -273,7 +273,7 @@ async def update( def list( self, **kwargs - ) -> AsyncIterable["models.LogProfileCollection"]: + ) -> AsyncIterable["_models.LogProfileCollection"]: """List the log profiles. :keyword callable cls: A custom type or function that will be passed the direct response @@ -281,7 +281,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.LogProfileCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogProfileCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -298,7 +298,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py index d788e2c65ddd6..c4dbe2449afee 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def list( resource_uri: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.MetricDefinitionCollection"]: + ) -> AsyncIterable["_models.MetricDefinitionCollection"]: """Lists the metric definitions for the resource. :param resource_uri: The identifier of the resource. @@ -63,7 +63,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -110,7 +110,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py index 71471635a72b9..7f21013f401e5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class AlertRuleIncidentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get( incident_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Incident" + # type: (...) -> "_models.Incident" """Gets an incident associated to an alert rule. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def get( :rtype: ~$(python-base-namespace).v2016_03_01.models.Incident :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Incident"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -80,7 +80,7 @@ def get( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), 'incidentName': self._serialize.url("incident_name", incident_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Incident', pipeline_response) @@ -115,7 +115,7 @@ def list_by_alert_rule( rule_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.IncidentListResult"] + # type: (...) -> Iterable["_models.IncidentListResult"] """Gets a list of incidents associated to an alert rule. :param resource_group_name: The name of the resource group. @@ -127,7 +127,7 @@ def list_by_alert_rule( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.IncidentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -146,7 +146,7 @@ def prepare_request(next_link=None): path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py index 16ce47ce66af6..e097d59035188 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class AlertRulesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str rule_name, # type: str - parameters, # type: "models.AlertRuleResource" + parameters, # type: "_models.AlertRuleResource" **kwargs # type: Any ): - # type: (...) -> "models.AlertRuleResource" + # type: (...) -> "_models.AlertRuleResource" """Creates or updates a classic metric alert rule. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2016_03_01.models.AlertRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -147,7 +147,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -177,7 +177,7 @@ def get( rule_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.AlertRuleResource" + # type: (...) -> "_models.AlertRuleResource" """Gets a classic metric alert rule. :param resource_group_name: The name of the resource group. @@ -189,7 +189,7 @@ def get( :rtype: ~$(python-base-namespace).v2016_03_01.models.AlertRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -202,7 +202,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -234,10 +234,10 @@ def update( self, resource_group_name, # type: str rule_name, # type: str - alert_rules_resource, # type: "models.AlertRuleResourcePatch" + alert_rules_resource, # type: "_models.AlertRuleResourcePatch" **kwargs # type: Any ): - # type: (...) -> "models.AlertRuleResource" + # type: (...) -> "_models.AlertRuleResource" """Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. @@ -252,7 +252,7 @@ def update( :rtype: ~$(python-base-namespace).v2016_03_01.models.AlertRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -264,7 +264,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -288,7 +288,7 @@ def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -308,7 +308,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.AlertRuleResourceCollection"] + # type: (...) -> Iterable["_models.AlertRuleResourceCollection"] """List the classic metric alert rules within a resource group. :param resource_group_name: The name of the resource group. @@ -318,7 +318,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -336,7 +336,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -378,7 +378,7 @@ def list_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.AlertRuleResourceCollection"] + # type: (...) -> Iterable["_models.AlertRuleResourceCollection"] """List the classic metric alert rules within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -386,7 +386,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,7 +403,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py index ee2669c3ce8fb..d630eb29ee31e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class LogProfilesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -71,7 +71,7 @@ def delete( url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -100,7 +100,7 @@ def get( log_profile_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.LogProfileResource" + # type: (...) -> "_models.LogProfileResource" """Gets the log profile. :param log_profile_name: The name of the log profile. @@ -110,7 +110,7 @@ def get( :rtype: ~$(python-base-namespace).v2016_03_01.models.LogProfileResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogProfileResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -122,7 +122,7 @@ def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -140,7 +140,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogProfileResource', pipeline_response) @@ -154,10 +154,10 @@ def get( def create_or_update( self, log_profile_name, # type: str - parameters, # type: "models.LogProfileResource" + parameters, # type: "_models.LogProfileResource" **kwargs # type: Any ): - # type: (...) -> "models.LogProfileResource" + # type: (...) -> "_models.LogProfileResource" """Create or update a log profile in Azure Monitoring REST API. :param log_profile_name: The name of the log profile. @@ -169,7 +169,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2016_03_01.models.LogProfileResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogProfileResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -182,7 +182,7 @@ def create_or_update( url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -217,10 +217,10 @@ def create_or_update( def update( self, log_profile_name, # type: str - log_profiles_resource, # type: "models.LogProfileResourcePatch" + log_profiles_resource, # type: "_models.LogProfileResourcePatch" **kwargs # type: Any ): - # type: (...) -> "models.LogProfileResource" + # type: (...) -> "_models.LogProfileResource" """Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. :param log_profile_name: The name of the log profile. @@ -232,7 +232,7 @@ def update( :rtype: ~$(python-base-namespace).v2016_03_01.models.LogProfileResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogProfileResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -244,7 +244,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -267,7 +267,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogProfileResource', pipeline_response) @@ -282,7 +282,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.LogProfileCollection"] + # type: (...) -> Iterable["_models.LogProfileCollection"] """List the log profiles. :keyword callable cls: A custom type or function that will be passed the direct response @@ -290,7 +290,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.LogProfileCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogProfileCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -307,7 +307,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py index 2e0ed174ea4dd..dd1a67a253201 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricDefinitionCollection"] + # type: (...) -> Iterable["_models.MetricDefinitionCollection"] """Lists the metric definitions for the resource. :param resource_uri: The identifier of the resource. @@ -68,7 +68,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -115,7 +115,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py index 06cfd9215638d..c3607ad334d17 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py @@ -43,7 +43,7 @@ def __init__( self.credential = credential self.api_version = "2016-09-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json index 9d418ad87650b..a9ebbe9478d41 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_client.py index bab11451938d6..3b7995ae4a4cb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_client.py @@ -49,7 +49,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.metrics = MetricsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py index 556fbaa2c95dc..e4edee68690cc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py @@ -40,7 +40,7 @@ def __init__( self.credential = credential self.api_version = "2016-09-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_client.py index 46a3165ac3e5f..9cfa6badc4d04 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_client.py @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.metrics = MetricsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py index d22879a77d72c..a16847bb3ecd9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def list( resource_uri: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.MetricCollection"]: + ) -> AsyncIterable["_models.MetricCollection"]: """Lists the metric values for a resource. :param resource_uri: The identifier of the resource. @@ -75,7 +75,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_09_01.models.MetricCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -122,7 +122,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py index b95f7509def48..44549740b5567 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class ServiceDiagnosticSettingsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ async def get( self, resource_uri: str, **kwargs - ) -> "models.ServiceDiagnosticSettingsResource": + ) -> "_models.ServiceDiagnosticSettingsResource": """Gets the active diagnostic settings for the specified resource. **WARNING**\ : This method will be deprecated in future releases. @@ -55,7 +55,7 @@ async def get( :rtype: ~$(python-base-namespace).v2016_09_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -84,7 +84,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) @@ -98,9 +98,9 @@ async def get( async def create_or_update( self, resource_uri: str, - parameters: "models.ServiceDiagnosticSettingsResource", + parameters: "_models.ServiceDiagnosticSettingsResource", **kwargs - ) -> "models.ServiceDiagnosticSettingsResource": + ) -> "_models.ServiceDiagnosticSettingsResource": """Create or update new diagnostic settings for the specified resource. **WARNING**\ : This method will be deprecated in future releases. @@ -113,7 +113,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2016_09_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,9 +160,9 @@ async def create_or_update( async def update( self, resource_uri: str, - service_diagnostic_settings_resource: "models.ServiceDiagnosticSettingsResourcePatch", + service_diagnostic_settings_resource: "_models.ServiceDiagnosticSettingsResourcePatch", **kwargs - ) -> "models.ServiceDiagnosticSettingsResource": + ) -> "_models.ServiceDiagnosticSettingsResource": """Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the CreateOrUpdate method. **WARNING**\ : This method will be deprecated in future releases. @@ -175,7 +175,7 @@ async def update( :rtype: ~$(python-base-namespace).v2016_09_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -209,7 +209,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py index 07de5370bc39d..cdf6a8557a8d0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricCollection"] + # type: (...) -> Iterable["_models.MetricCollection"] """Lists the metric values for a resource. :param resource_uri: The identifier of the resource. @@ -80,7 +80,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_09_01.models.MetricCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -127,7 +127,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py index 9d3dceb5e7853..4bf7526dd8b16 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class ServiceDiagnosticSettingsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def get( resource_uri, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ServiceDiagnosticSettingsResource" + # type: (...) -> "_models.ServiceDiagnosticSettingsResource" """Gets the active diagnostic settings for the specified resource. **WARNING**\ : This method will be deprecated in future releases. @@ -60,7 +60,7 @@ def get( :rtype: ~$(python-base-namespace).v2016_09_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -89,7 +89,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) @@ -103,10 +103,10 @@ def get( def create_or_update( self, resource_uri, # type: str - parameters, # type: "models.ServiceDiagnosticSettingsResource" + parameters, # type: "_models.ServiceDiagnosticSettingsResource" **kwargs # type: Any ): - # type: (...) -> "models.ServiceDiagnosticSettingsResource" + # type: (...) -> "_models.ServiceDiagnosticSettingsResource" """Create or update new diagnostic settings for the specified resource. **WARNING**\ : This method will be deprecated in future releases. @@ -119,7 +119,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2016_09_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -166,10 +166,10 @@ def create_or_update( def update( self, resource_uri, # type: str - service_diagnostic_settings_resource, # type: "models.ServiceDiagnosticSettingsResourcePatch" + service_diagnostic_settings_resource, # type: "_models.ServiceDiagnosticSettingsResourcePatch" **kwargs # type: Any ): - # type: (...) -> "models.ServiceDiagnosticSettingsResource" + # type: (...) -> "_models.ServiceDiagnosticSettingsResource" """Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the CreateOrUpdate method. **WARNING**\ : This method will be deprecated in future releases. @@ -182,7 +182,7 @@ def update( :rtype: ~$(python-base-namespace).v2016_09_01.models.ServiceDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ServiceDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -216,7 +216,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py index 6779035b4e492..fcb3564874c65 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2017-03-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json index 23a85011ca53b..2faba829c9fa4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_client.py index e39815a810f4e..b182de1b3f5c0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_client.py @@ -29,7 +29,7 @@ class MonitorClient(object): :vartype activity_log_alerts: $(python-base-namespace).v2017_03_01_preview.operations.ActivityLogAlertsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -49,7 +49,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.activity_log_alerts = ActivityLogAlertsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py index a83bda6bfbcfe..14f365399402a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2017-03-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_client.py index 77a618a91249c..251777fb9a7ca 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_client.py @@ -27,7 +27,7 @@ class MonitorClient(object): :vartype activity_log_alerts: $(python-base-namespace).v2017_03_01_preview.aio.operations.ActivityLogAlertsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.activity_log_alerts = ActivityLogAlertsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py index e52db335da2e5..eb7657627b2e9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ActivityLogAlertsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, activity_log_alert_name: str, - activity_log_alert: "models.ActivityLogAlertResource", + activity_log_alert: "_models.ActivityLogAlertResource", **kwargs - ) -> "models.ActivityLogAlertResource": + ) -> "_models.ActivityLogAlertResource": """Create a new activity log alert or update an existing one. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -73,7 +73,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( resource_group_name: str, activity_log_alert_name: str, **kwargs - ) -> "models.ActivityLogAlertResource": + ) -> "_models.ActivityLogAlertResource": """Get an activity log alert. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ async def get( :rtype: ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -140,7 +140,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -199,7 +199,7 @@ async def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -231,9 +231,9 @@ async def update( self, resource_group_name: str, activity_log_alert_name: str, - activity_log_alert_patch: "models.ActivityLogAlertResourcePatch", + activity_log_alert_patch: "_models.ActivityLogAlertResourcePatch", **kwargs - ) -> "models.ActivityLogAlertResource": + ) -> "_models.ActivityLogAlertResource": """Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. @@ -248,7 +248,7 @@ async def update( :rtype: ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -260,7 +260,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -284,7 +284,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -298,7 +298,7 @@ async def update( def list_by_subscription_id( self, **kwargs - ) -> AsyncIterable["models.ActivityLogAlertList"]: + ) -> AsyncIterable["_models.ActivityLogAlertList"]: """Get a list of all activity log alerts in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -306,7 +306,7 @@ def list_by_subscription_id( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -323,7 +323,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -351,7 +351,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -366,7 +366,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.ActivityLogAlertList"]: + ) -> AsyncIterable["_models.ActivityLogAlertList"]: """Get a list of all activity log alerts in a resource group. :param resource_group_name: The name of the resource group. @@ -376,7 +376,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,7 +393,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -422,7 +422,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py index 1020ef2bd8a59..57de9f7a81b99 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ActivityLogAlertsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str activity_log_alert_name, # type: str - activity_log_alert, # type: "models.ActivityLogAlertResource" + activity_log_alert, # type: "_models.ActivityLogAlertResource" **kwargs # type: Any ): - # type: (...) -> "models.ActivityLogAlertResource" + # type: (...) -> "_models.ActivityLogAlertResource" """Create a new activity log alert or update an existing one. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -78,7 +78,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -123,7 +123,7 @@ def get( activity_log_alert_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ActivityLogAlertResource" + # type: (...) -> "_models.ActivityLogAlertResource" """Get an activity log alert. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ def get( :rtype: ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -146,7 +146,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -206,7 +206,7 @@ def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -238,10 +238,10 @@ def update( self, resource_group_name, # type: str activity_log_alert_name, # type: str - activity_log_alert_patch, # type: "models.ActivityLogAlertResourcePatch" + activity_log_alert_patch, # type: "_models.ActivityLogAlertResourcePatch" **kwargs # type: Any ): - # type: (...) -> "models.ActivityLogAlertResource" + # type: (...) -> "_models.ActivityLogAlertResource" """Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. @@ -256,7 +256,7 @@ def update( :rtype: ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -268,7 +268,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -292,7 +292,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -307,7 +307,7 @@ def list_by_subscription_id( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActivityLogAlertList"] + # type: (...) -> Iterable["_models.ActivityLogAlertList"] """Get a list of all activity log alerts in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -315,7 +315,7 @@ def list_by_subscription_id( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -332,7 +332,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -360,7 +360,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -376,7 +376,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActivityLogAlertList"] + # type: (...) -> Iterable["_models.ActivityLogAlertList"] """Get a list of all activity log alerts in a resource group. :param resource_group_name: The name of the resource group. @@ -386,7 +386,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,7 +403,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -432,7 +432,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py index 1a5aecea0642a..bc4592a69bab2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2017-04-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json index baad6b31e0ee1..fa3a79740cb07 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_client.py index 2c4ba50d209c9..977cd6d6089a0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_client.py @@ -32,7 +32,7 @@ class MonitorClient(object): :vartype activity_log_alerts: $(python-base-namespace).v2017_04_01.operations.ActivityLogAlertsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -52,7 +52,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py index e55bc4d5c7dac..1447112a163df 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2017-04-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_client.py index c7575510e4410..e7bc0061da7e6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_client.py @@ -30,7 +30,7 @@ class MonitorClient(object): :vartype activity_log_alerts: $(python-base-namespace).v2017_04_01.aio.operations.ActivityLogAlertsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -49,7 +49,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py index 91b5b91f906ad..6f1f0cd91e9ee 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ActionGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, action_group_name: str, - action_group: "models.ActionGroupResource", + action_group: "_models.ActionGroupResource", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( resource_group_name: str, action_group_name: str, **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Get an action group. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ async def get( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -231,9 +231,9 @@ async def update( self, resource_group_name: str, action_group_name: str, - action_group_patch: "models.ActionGroupPatchBody", + action_group_patch: "_models.ActionGroupPatchBody", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -247,7 +247,7 @@ async def update( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -297,7 +297,7 @@ async def update( def list_by_subscription_id( self, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -305,7 +305,7 @@ def list_by_subscription_id( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_04_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -365,7 +365,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -375,7 +375,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_04_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -436,7 +436,7 @@ async def enable_receiver( self, resource_group_name: str, action_group_name: str, - enable_request: "models.EnableRequest", + enable_request: "_models.EnableRequest", **kwargs ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py index 2e889f8bcc58a..b3e1bb02a22f7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ActivityLogAlertsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, activity_log_alert_name: str, - activity_log_alert: "models.ActivityLogAlertResource", + activity_log_alert: "_models.ActivityLogAlertResource", **kwargs - ) -> "models.ActivityLogAlertResource": + ) -> "_models.ActivityLogAlertResource": """Create a new activity log alert or update an existing one. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -73,7 +73,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( resource_group_name: str, activity_log_alert_name: str, **kwargs - ) -> "models.ActivityLogAlertResource": + ) -> "_models.ActivityLogAlertResource": """Get an activity log alert. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ async def get( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -140,7 +140,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -199,7 +199,7 @@ async def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -231,9 +231,9 @@ async def update( self, resource_group_name: str, activity_log_alert_name: str, - activity_log_alert_patch: "models.ActivityLogAlertPatchBody", + activity_log_alert_patch: "_models.ActivityLogAlertPatchBody", **kwargs - ) -> "models.ActivityLogAlertResource": + ) -> "_models.ActivityLogAlertResource": """Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. @@ -248,7 +248,7 @@ async def update( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -260,7 +260,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -284,7 +284,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -298,7 +298,7 @@ async def update( def list_by_subscription_id( self, **kwargs - ) -> AsyncIterable["models.ActivityLogAlertList"]: + ) -> AsyncIterable["_models.ActivityLogAlertList"]: """Get a list of all activity log alerts in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -306,7 +306,7 @@ def list_by_subscription_id( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -323,7 +323,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -351,7 +351,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -366,7 +366,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.ActivityLogAlertList"]: + ) -> AsyncIterable["_models.ActivityLogAlertList"]: """Get a list of all activity log alerts in a resource group. :param resource_group_name: The name of the resource group. @@ -376,7 +376,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,7 +393,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -422,7 +422,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py index 1a29bdc4ca452..512e9b73fcd45 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ActionGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str action_group_name, # type: str - action_group, # type: "models.ActionGroupResource" + action_group, # type: "_models.ActionGroupResource" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -123,7 +123,7 @@ def get( action_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Get an action group. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ def get( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -238,10 +238,10 @@ def update( self, resource_group_name, # type: str action_group_name, # type: str - action_group_patch, # type: "models.ActionGroupPatchBody" + action_group_patch, # type: "_models.ActionGroupPatchBody" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -255,7 +255,7 @@ def update( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -306,7 +306,7 @@ def list_by_subscription_id( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -314,7 +314,7 @@ def list_by_subscription_id( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_04_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -375,7 +375,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -385,7 +385,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_04_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -446,7 +446,7 @@ def enable_receiver( self, resource_group_name, # type: str action_group_name, # type: str - enable_request, # type: "models.EnableRequest" + enable_request, # type: "_models.EnableRequest" **kwargs # type: Any ): # type: (...) -> None @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py index 31437df9c13f4..9fba898f42793 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ActivityLogAlertsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str activity_log_alert_name, # type: str - activity_log_alert, # type: "models.ActivityLogAlertResource" + activity_log_alert, # type: "_models.ActivityLogAlertResource" **kwargs # type: Any ): - # type: (...) -> "models.ActivityLogAlertResource" + # type: (...) -> "_models.ActivityLogAlertResource" """Create a new activity log alert or update an existing one. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -78,7 +78,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -123,7 +123,7 @@ def get( activity_log_alert_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ActivityLogAlertResource" + # type: (...) -> "_models.ActivityLogAlertResource" """Get an activity log alert. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ def get( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -146,7 +146,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -206,7 +206,7 @@ def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -238,10 +238,10 @@ def update( self, resource_group_name, # type: str activity_log_alert_name, # type: str - activity_log_alert_patch, # type: "models.ActivityLogAlertPatchBody" + activity_log_alert_patch, # type: "_models.ActivityLogAlertPatchBody" **kwargs # type: Any ): - # type: (...) -> "models.ActivityLogAlertResource" + # type: (...) -> "_models.ActivityLogAlertResource" """Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. @@ -256,7 +256,7 @@ def update( :rtype: ~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -268,7 +268,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -292,7 +292,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -307,7 +307,7 @@ def list_by_subscription_id( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActivityLogAlertList"] + # type: (...) -> Iterable["_models.ActivityLogAlertList"] """Get a list of all activity log alerts in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -315,7 +315,7 @@ def list_by_subscription_id( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -332,7 +332,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -360,7 +360,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -376,7 +376,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActivityLogAlertList"] + # type: (...) -> Iterable["_models.ActivityLogAlertList"] """Get a list of all activity log alerts in a resource group. :param resource_group_name: The name of the resource group. @@ -386,7 +386,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActivityLogAlertList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,7 +403,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -432,7 +432,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py index 7900fde3b236c..42be0e5ff4406 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py @@ -28,22 +28,28 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str """ def __init__( self, credential, # type: "TokenCredential" + subscription_id, # type: str **kwargs # type: Any ): # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential + self.subscription_id = subscription_id self.api_version = "2017-05-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_metadata.json index 52324983dd780..bb504726c78d3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_metadata.json @@ -8,28 +8,41 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true } }, "constant": { }, - "call": "credential" + "call": "credential, subscription_id" }, "config": { "credential": true, diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_client.py index f993b0d21f3bc..bd4737e84fe55 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_client.py @@ -41,24 +41,26 @@ class MonitorClient(object): :vartype subscription_diagnostic_settings: $(python-base-namespace).v2017_05_01_preview.operations.SubscriptionDiagnosticSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str :param str base_url: Service URL """ def __init__( self, credential, # type: "TokenCredential" + subscription_id, # type: str base_url=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.diagnostic_settings_category = DiagnosticSettingsCategoryOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py index ed3403f0731d9..586e70bef5959 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py @@ -26,21 +26,27 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str """ def __init__( self, credential: "AsyncTokenCredential", + subscription_id: str, **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential + self.subscription_id = subscription_id self.api_version = "2017-05-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_client.py index 54b8e0318734e..a5aac63fcbe93 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_client.py @@ -39,23 +39,25 @@ class MonitorClient(object): :vartype subscription_diagnostic_settings: $(python-base-namespace).v2017_05_01_preview.aio.operations.SubscriptionDiagnosticSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str :param str base_url: Service URL """ def __init__( self, credential: "AsyncTokenCredential", + subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.diagnostic_settings_category = DiagnosticSettingsCategoryOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py index 2f8059814a66f..cb356ad37a9a6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class DiagnosticSettingsCategoryOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def get( resource_uri: str, name: str, **kwargs - ) -> "models.DiagnosticSettingsCategoryResource": + ) -> "_models.DiagnosticSettingsCategoryResource": """Gets the diagnostic settings category for the specified resource. :param resource_uri: The identifier of the resource. @@ -57,7 +57,7 @@ async def get( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsCategoryResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsCategoryResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -87,7 +87,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsCategoryResource', pipeline_response) @@ -102,7 +102,7 @@ async def list( self, resource_uri: str, **kwargs - ) -> "models.DiagnosticSettingsCategoryResourceCollection": + ) -> "_models.DiagnosticSettingsCategoryResourceCollection": """Lists the diagnostic settings categories for the specified resource. :param resource_uri: The identifier of the resource. @@ -112,7 +112,7 @@ async def list( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsCategoryResourceCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsCategoryResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -141,7 +141,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsCategoryResourceCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py index 1c24fe090cbc3..95c8a5fd4f212 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class DiagnosticSettingsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def get( resource_uri: str, name: str, **kwargs - ) -> "models.DiagnosticSettingsResource": + ) -> "_models.DiagnosticSettingsResource": """Gets the active diagnostic settings for the specified resource. :param resource_uri: The identifier of the resource. @@ -57,7 +57,7 @@ async def get( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -87,7 +87,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) @@ -102,9 +102,9 @@ async def create_or_update( self, resource_uri: str, name: str, - parameters: "models.DiagnosticSettingsResource", + parameters: "_models.DiagnosticSettingsResource", **kwargs - ) -> "models.DiagnosticSettingsResource": + ) -> "_models.DiagnosticSettingsResource": """Creates or updates diagnostic settings for the specified resource. :param resource_uri: The identifier of the resource. @@ -118,7 +118,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -153,7 +153,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) @@ -211,7 +211,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -223,7 +223,7 @@ async def list( self, resource_uri: str, **kwargs - ) -> "models.DiagnosticSettingsResourceCollection": + ) -> "_models.DiagnosticSettingsResourceCollection": """Gets the active diagnostic settings list for the specified resource. :param resource_uri: The identifier of the resource. @@ -233,7 +233,7 @@ async def list( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsResourceCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -262,7 +262,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResourceCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py index 4861496d3b7a7..de54aaaa25486 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ def list( self, resource_uri: str, **kwargs - ) -> AsyncIterable["models.MetricDefinitionCollection"]: + ) -> AsyncIterable["_models.MetricDefinitionCollection"]: """Lists the metric definitions for the resource. :param resource_uri: The identifier of the resource. @@ -55,7 +55,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_05_01_preview.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -100,7 +100,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py index 7c9ab28b7877c..e5acd4985819d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -51,9 +51,9 @@ async def list( top: Optional[int] = None, orderby: Optional[str] = None, filter: Optional[str] = None, - result_type: Optional[Union[str, "models.ResultType"]] = None, + result_type: Optional[Union[str, "_models.ResultType"]] = None, **kwargs - ) -> "models.Response": + ) -> "_models.Response": """**Lists the metric values for a resource**. :param resource_uri: The identifier of the resource. @@ -93,7 +93,7 @@ async def list( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.Response :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Response"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Response"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -138,7 +138,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Response', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py index 4a5cf58453bf1..7a4503afc0843 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class SubscriptionDiagnosticSettingsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -42,14 +42,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get( self, - subscription_id: str, name: str, **kwargs - ) -> "models.SubscriptionDiagnosticSettingsResource": + ) -> "_models.SubscriptionDiagnosticSettingsResource": """Gets the active subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +54,7 @@ async def get( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -68,7 +65,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -87,7 +84,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) @@ -100,15 +97,12 @@ async def get( async def create_or_update( self, - subscription_id: str, name: str, - parameters: "models.SubscriptionDiagnosticSettingsResource", + parameters: "_models.SubscriptionDiagnosticSettingsResource", **kwargs - ) -> "models.SubscriptionDiagnosticSettingsResource": + ) -> "_models.SubscriptionDiagnosticSettingsResource": """Creates or updates subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :param parameters: Parameters supplied to the operation. @@ -118,7 +112,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -130,7 +124,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -153,7 +147,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) @@ -166,14 +160,11 @@ async def create_or_update( async def delete( self, - subscription_id: str, name: str, **kwargs ) -> None: """Deletes existing subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -192,7 +183,7 @@ async def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -211,7 +202,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -221,19 +212,16 @@ async def delete( async def list( self, - subscription_id: str, **kwargs - ) -> "models.SubscriptionDiagnosticSettingsResourceCollection": + ) -> "_models.SubscriptionDiagnosticSettingsResourceCollection": """Gets the active subscription diagnostic settings list for the specified subscriptionId. - :param subscription_id: The subscription id. - :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionDiagnosticSettingsResourceCollection, or the result of cls(response) :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResourceCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -244,7 +232,7 @@ async def list( # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -262,7 +250,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResourceCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py index c02bcb56365d0..b4f988ccfad0a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class DiagnosticSettingsCategoryOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def get( name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DiagnosticSettingsCategoryResource" + # type: (...) -> "_models.DiagnosticSettingsCategoryResource" """Gets the diagnostic settings category for the specified resource. :param resource_uri: The identifier of the resource. @@ -62,7 +62,7 @@ def get( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsCategoryResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsCategoryResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -92,7 +92,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsCategoryResource', pipeline_response) @@ -108,7 +108,7 @@ def list( resource_uri, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DiagnosticSettingsCategoryResourceCollection" + # type: (...) -> "_models.DiagnosticSettingsCategoryResourceCollection" """Lists the diagnostic settings categories for the specified resource. :param resource_uri: The identifier of the resource. @@ -118,7 +118,7 @@ def list( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsCategoryResourceCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsCategoryResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -147,7 +147,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsCategoryResourceCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py index 542a2b2ecd705..c1a0017ef0070 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class DiagnosticSettingsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def get( name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DiagnosticSettingsResource" + # type: (...) -> "_models.DiagnosticSettingsResource" """Gets the active diagnostic settings for the specified resource. :param resource_uri: The identifier of the resource. @@ -62,7 +62,7 @@ def get( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -92,7 +92,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) @@ -107,10 +107,10 @@ def create_or_update( self, resource_uri, # type: str name, # type: str - parameters, # type: "models.DiagnosticSettingsResource" + parameters, # type: "_models.DiagnosticSettingsResource" **kwargs # type: Any ): - # type: (...) -> "models.DiagnosticSettingsResource" + # type: (...) -> "_models.DiagnosticSettingsResource" """Creates or updates diagnostic settings for the specified resource. :param resource_uri: The identifier of the resource. @@ -124,7 +124,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -159,7 +159,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) @@ -218,7 +218,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -231,7 +231,7 @@ def list( resource_uri, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DiagnosticSettingsResourceCollection" + # type: (...) -> "_models.DiagnosticSettingsResourceCollection" """Gets the active diagnostic settings list for the specified resource. :param resource_uri: The identifier of the resource. @@ -241,7 +241,7 @@ def list( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsResourceCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnosticSettingsResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -270,7 +270,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResourceCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py index 9d055f98dceb2..fe8410940a9dc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list( resource_uri, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricDefinitionCollection"] + # type: (...) -> Iterable["_models.MetricDefinitionCollection"] """Lists the metric definitions for the resource. :param resource_uri: The identifier of the resource. @@ -60,7 +60,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_05_01_preview.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py index bda90bf8d2d4c..f784c87fe1669 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,10 +55,10 @@ def list( top=None, # type: Optional[int] orderby=None, # type: Optional[str] filter=None, # type: Optional[str] - result_type=None, # type: Optional[Union[str, "models.ResultType"]] + result_type=None, # type: Optional[Union[str, "_models.ResultType"]] **kwargs # type: Any ): - # type: (...) -> "models.Response" + # type: (...) -> "_models.Response" """**Lists the metric values for a resource**. :param resource_uri: The identifier of the resource. @@ -98,7 +98,7 @@ def list( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.Response :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Response"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Response"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -143,7 +143,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Response', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py index ed6be77f0587c..eb8d627fb6c7d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class SubscriptionDiagnosticSettingsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -46,15 +46,12 @@ def __init__(self, client, config, serializer, deserializer): def get( self, - subscription_id, # type: str name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.SubscriptionDiagnosticSettingsResource" + # type: (...) -> "_models.SubscriptionDiagnosticSettingsResource" """Gets the active subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,7 +59,7 @@ def get( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -73,7 +70,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -92,7 +89,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) @@ -105,16 +102,13 @@ def get( def create_or_update( self, - subscription_id, # type: str name, # type: str - parameters, # type: "models.SubscriptionDiagnosticSettingsResource" + parameters, # type: "_models.SubscriptionDiagnosticSettingsResource" **kwargs # type: Any ): - # type: (...) -> "models.SubscriptionDiagnosticSettingsResource" + # type: (...) -> "_models.SubscriptionDiagnosticSettingsResource" """Creates or updates subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :param parameters: Parameters supplied to the operation. @@ -124,7 +118,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -136,7 +130,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -159,7 +153,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) @@ -172,15 +166,12 @@ def create_or_update( def delete( self, - subscription_id, # type: str name, # type: str **kwargs # type: Any ): # type: (...) -> None """Deletes existing subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -199,7 +190,7 @@ def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -218,7 +209,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -228,20 +219,17 @@ def delete( def list( self, - subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.SubscriptionDiagnosticSettingsResourceCollection" + # type: (...) -> "_models.SubscriptionDiagnosticSettingsResourceCollection" """Gets the active subscription diagnostic settings list for the specified subscriptionId. - :param subscription_id: The subscription id. - :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionDiagnosticSettingsResourceCollection, or the result of cls(response) :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResourceCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -252,7 +240,7 @@ def list( # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -270,7 +258,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResourceCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py index 519a3e172d74e..d0fb26233a4a8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py @@ -43,7 +43,7 @@ def __init__( self.credential = credential self.api_version = "2017-11-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json index 27fac2a7af1f9..032220920274e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_client.py index 251b6bd7ae113..3c48248a52c13 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_client.py @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.metric_baseline = MetricBaselineOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py index fee89e6406961..28b010a60fb59 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py @@ -40,7 +40,7 @@ def __init__( self.credential = credential self.api_version = "2017-11-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_client.py index eccc4e77501ae..a34fecffc2872 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_client.py @@ -43,7 +43,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.metric_baseline = MetricBaselineOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py index fff71a39e22b3..5bcaa3d19005b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricBaselineOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,9 +49,9 @@ async def get( interval: Optional[datetime.timedelta] = None, aggregation: Optional[str] = None, sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "models.ResultType"]] = None, + result_type: Optional[Union[str, "_models.ResultType"]] = None, **kwargs - ) -> "models.BaselineResponse": + ) -> "_models.BaselineResponse": """**Gets the baseline values for a specific metric**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -78,7 +78,7 @@ async def get( :rtype: ~$(python-base-namespace).v2017_11_01_preview.models.BaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.BaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -118,7 +118,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -127,14 +127,14 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore async def calculate_baseline( self, resource_uri: str, - time_series_information: "models.TimeSeriesInformation", + time_series_information: "_models.TimeSeriesInformation", **kwargs - ) -> "models.CalculateBaselineResponse": + ) -> "_models.CalculateBaselineResponse": """**Lists the baseline values for a resource**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -150,7 +150,7 @@ async def calculate_baseline( :rtype: ~$(python-base-namespace).v2017_11_01_preview.models.CalculateBaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CalculateBaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateBaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -184,7 +184,7 @@ async def calculate_baseline( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py index ce966a8a01032..0b2aab63413b4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py @@ -22,6 +22,8 @@ class Baseline(msrest.serialization.Model): :type low_thresholds: list[float] :param high_thresholds: Required. The high thresholds of the baseline. :type high_thresholds: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] """ _validation = { @@ -34,6 +36,7 @@ class Baseline(msrest.serialization.Model): 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, } def __init__( @@ -44,6 +47,7 @@ def __init__( self.sensitivity = kwargs['sensitivity'] self.low_thresholds = kwargs['low_thresholds'] self.high_thresholds = kwargs['high_thresholds'] + self.timestamps = kwargs.get('timestamps', None) class BaselineMetadataValue(msrest.serialization.Model): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py index d2099a15f6cb9..3f49d6e6bec29 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py @@ -27,6 +27,8 @@ class Baseline(msrest.serialization.Model): :type low_thresholds: list[float] :param high_thresholds: Required. The high thresholds of the baseline. :type high_thresholds: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] """ _validation = { @@ -39,6 +41,7 @@ class Baseline(msrest.serialization.Model): 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, } def __init__( @@ -47,12 +50,14 @@ def __init__( sensitivity: Union[str, "Sensitivity"], low_thresholds: List[float], high_thresholds: List[float], + timestamps: Optional[List[datetime.datetime]] = None, **kwargs ): super(Baseline, self).__init__(**kwargs) self.sensitivity = sensitivity self.low_thresholds = low_thresholds self.high_thresholds = high_thresholds + self.timestamps = timestamps class BaselineMetadataValue(msrest.serialization.Model): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py index fee333322b085..0010c8126877a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricBaselineOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,10 +53,10 @@ def get( interval=None, # type: Optional[datetime.timedelta] aggregation=None, # type: Optional[str] sensitivities=None, # type: Optional[str] - result_type=None, # type: Optional[Union[str, "models.ResultType"]] + result_type=None, # type: Optional[Union[str, "_models.ResultType"]] **kwargs # type: Any ): - # type: (...) -> "models.BaselineResponse" + # type: (...) -> "_models.BaselineResponse" """**Gets the baseline values for a specific metric**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -83,7 +83,7 @@ def get( :rtype: ~$(python-base-namespace).v2017_11_01_preview.models.BaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.BaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -123,7 +123,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -132,15 +132,15 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore def calculate_baseline( self, resource_uri, # type: str - time_series_information, # type: "models.TimeSeriesInformation" + time_series_information, # type: "_models.TimeSeriesInformation" **kwargs # type: Any ): - # type: (...) -> "models.CalculateBaselineResponse" + # type: (...) -> "_models.CalculateBaselineResponse" """**Lists the baseline values for a resource**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -156,7 +156,7 @@ def calculate_baseline( :rtype: ~$(python-base-namespace).v2017_11_01_preview.models.CalculateBaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CalculateBaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateBaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -190,7 +190,7 @@ def calculate_baseline( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py index 3b15522c5f9c7..f791805e52f26 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py @@ -43,7 +43,7 @@ def __init__( self.credential = credential self.api_version = "2017-12-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json index 5d938f67dd49c..90b18ede7f520 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_client.py index d3328a470f3a1..7dc3c6fcb82ec 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_client.py @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.metric_namespaces = MetricNamespacesOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py index f9a108ffbc2bd..00dc29134a32f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py @@ -40,7 +40,7 @@ def __init__( self.credential = credential self.api_version = "2017-12-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_client.py index 93c631613bfa2..7371583d4223d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_client.py @@ -43,7 +43,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.metric_namespaces = MetricNamespacesOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py index 29042ab210250..15497b8ed00c8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricNamespacesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def list( resource_uri: str, start_time: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.MetricNamespaceCollection"]: + ) -> AsyncIterable["_models.MetricNamespaceCollection"]: """Lists the metric namespaces for the resource. :param resource_uri: The identifier of the resource. @@ -59,7 +59,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_12_01_preview.models.MetricNamespaceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricNamespaceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricNamespaceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -106,7 +106,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py index 255ba377af8de..247d93eac5fde 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricNamespacesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( start_time=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricNamespaceCollection"] + # type: (...) -> Iterable["_models.MetricNamespaceCollection"] """Lists the metric namespaces for the resource. :param resource_uri: The identifier of the resource. @@ -64,7 +64,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_12_01_preview.models.MetricNamespaceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricNamespaceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricNamespaceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -111,7 +111,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py index efc917163bc60..449982bc94c71 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py @@ -43,7 +43,7 @@ def __init__( self.credential = credential self.api_version = "2018-01-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json index 773155f7320d3..b4d69509a4328 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_client.py index 49362a2013082..d49d26f76ec57 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_client.py @@ -49,7 +49,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.metric_definitions = MetricDefinitionsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py index f38c670682263..3357ffb00a13a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py @@ -40,7 +40,7 @@ def __init__( self.credential = credential self.api_version = "2018-01-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_client.py index 2ea519ee0b2da..41b74d643867f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_client.py @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.metric_definitions = MetricDefinitionsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py index d14bfaaef84ec..634aa84501b5b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def list( resource_uri: str, metricnamespace: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.MetricDefinitionCollection"]: + ) -> AsyncIterable["_models.MetricDefinitionCollection"]: """Lists the metric definitions for the resource. :param resource_uri: The identifier of the resource. @@ -58,7 +58,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_01_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py index 60bd670a79eec..f59760d272b8f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -51,10 +51,10 @@ async def list( top: Optional[int] = None, orderby: Optional[str] = None, filter: Optional[str] = None, - result_type: Optional[Union[str, "models.ResultType"]] = None, + result_type: Optional[Union[str, "_models.ResultType"]] = None, metricnamespace: Optional[str] = None, **kwargs - ) -> "models.Response": + ) -> "_models.Response": """**Lists the metric values for a resource**. :param resource_uri: The identifier of the resource. @@ -96,7 +96,7 @@ async def list( :rtype: ~$(python-base-namespace).v2018_01_01.models.Response :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Response"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Response"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -143,7 +143,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Response', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py index 59060fc385502..03e9da0f5741c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( metricnamespace=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricDefinitionCollection"] + # type: (...) -> Iterable["_models.MetricDefinitionCollection"] """Lists the metric definitions for the resource. :param resource_uri: The identifier of the resource. @@ -63,7 +63,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_01_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricDefinitionCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -110,7 +110,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py index adef5b73c7d5b..0c4201e92e8ab 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,11 +55,11 @@ def list( top=None, # type: Optional[int] orderby=None, # type: Optional[str] filter=None, # type: Optional[str] - result_type=None, # type: Optional[Union[str, "models.ResultType"]] + result_type=None, # type: Optional[Union[str, "_models.ResultType"]] metricnamespace=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Response" + # type: (...) -> "_models.Response" """**Lists the metric values for a resource**. :param resource_uri: The identifier of the resource. @@ -101,7 +101,7 @@ def list( :rtype: ~$(python-base-namespace).v2018_01_01.models.Response :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Response"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Response"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -148,7 +148,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Response', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py index e17c5db0c2000..718b0b39e1483 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json index d19d65e12c339..e09c455355280 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_client.py index 89ec276866767..354331be0fd19 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_client.py @@ -35,7 +35,7 @@ class MonitorClient(object): :vartype metric_alerts_status: $(python-base-namespace).v2018_03_01.operations.MetricAlertsStatusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -55,7 +55,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py index 110ba3677e13d..1eaafa2d0ef38 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_client.py index c494d8a983190..c57af291d385b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_client.py @@ -33,7 +33,7 @@ class MonitorClient(object): :vartype metric_alerts_status: $(python-base-namespace).v2018_03_01.aio.operations.MetricAlertsStatusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -52,7 +52,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py index e0062d85fda31..20fff72692cba 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ActionGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, action_group_name: str, - action_group: "models.ActionGroupResource", + action_group: "_models.ActionGroupResource", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2018_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( resource_group_name: str, action_group_name: str, **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Get an action group. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ async def get( :rtype: ~$(python-base-namespace).v2018_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -231,9 +231,9 @@ async def update( self, resource_group_name: str, action_group_name: str, - action_group_patch: "models.ActionGroupPatchBody", + action_group_patch: "_models.ActionGroupPatchBody", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -247,7 +247,7 @@ async def update( :rtype: ~$(python-base-namespace).v2018_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -297,7 +297,7 @@ async def update( def list_by_subscription_id( self, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -305,7 +305,7 @@ def list_by_subscription_id( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -365,7 +365,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -375,7 +375,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -436,7 +436,7 @@ async def enable_receiver( self, resource_group_name: str, action_group_name: str, - enable_request: "models.EnableRequest", + enable_request: "_models.EnableRequest", **kwargs ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py index c1a2bffbd3431..bcb7ec9eb3cbd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricAlertsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_by_subscription( self, **kwargs - ) -> AsyncIterable["models.MetricAlertResourceCollection"]: + ) -> AsyncIterable["_models.MetricAlertResourceCollection"]: """Retrieve alert rule definitions in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_03_01.models.MetricAlertResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -69,7 +69,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -97,7 +97,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -112,7 +112,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.MetricAlertResourceCollection"]: + ) -> AsyncIterable["_models.MetricAlertResourceCollection"]: """Retrieve alert rule definitions in a resource group. :param resource_group_name: The name of the resource group. @@ -122,7 +122,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_03_01.models.MetricAlertResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -139,7 +139,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -168,7 +168,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -184,7 +184,7 @@ async def get( resource_group_name: str, rule_name: str, **kwargs - ) -> "models.MetricAlertResource": + ) -> "_models.MetricAlertResource": """Retrieve an alert rule definition. :param resource_group_name: The name of the resource group. @@ -196,7 +196,7 @@ async def get( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -207,7 +207,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -227,7 +227,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -242,9 +242,9 @@ async def create_or_update( self, resource_group_name: str, rule_name: str, - parameters: "models.MetricAlertResource", + parameters: "_models.MetricAlertResource", **kwargs - ) -> "models.MetricAlertResource": + ) -> "_models.MetricAlertResource": """Create or update an metric alert definition. :param resource_group_name: The name of the resource group. @@ -258,7 +258,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -270,7 +270,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -294,7 +294,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -309,9 +309,9 @@ async def update( self, resource_group_name: str, rule_name: str, - parameters: "models.MetricAlertResourcePatch", + parameters: "_models.MetricAlertResourcePatch", **kwargs - ) -> "models.MetricAlertResource": + ) -> "_models.MetricAlertResource": """Update an metric alert definition. :param resource_group_name: The name of the resource group. @@ -325,7 +325,7 @@ async def update( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -337,7 +337,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -361,7 +361,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -395,11 +395,12 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-03-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -411,6 +412,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -418,7 +420,8 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py index dbfe12ec9822f..5d54d2126dd11 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class MetricAlertsStatusOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list( resource_group_name: str, rule_name: str, **kwargs - ) -> "models.MetricAlertStatusCollection": + ) -> "_models.MetricAlertStatusCollection": """Retrieve an alert rule status. :param resource_group_name: The name of the resource group. @@ -57,7 +57,7 @@ async def list( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertStatusCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertStatusCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertStatusCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -68,7 +68,7 @@ async def list( # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -88,7 +88,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertStatusCollection', pipeline_response) @@ -105,7 +105,7 @@ async def list_by_name( rule_name: str, status_name: str, **kwargs - ) -> "models.MetricAlertStatusCollection": + ) -> "_models.MetricAlertStatusCollection": """Retrieve an alert rule status. :param resource_group_name: The name of the resource group. @@ -119,7 +119,7 @@ async def list_by_name( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertStatusCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertStatusCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertStatusCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -130,7 +130,7 @@ async def list_by_name( # Construct URL url = self.list_by_name.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), 'statusName': self._serialize.url("status_name", status_name, 'str'), @@ -151,7 +151,7 @@ async def list_by_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertStatusCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py index 383f83b2de18f..88e96542db434 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py @@ -72,7 +72,7 @@ from ._models import WebtestLocationAvailabilityCriteria # type: ignore from ._monitor_client_enums import ( - AggregationType, + AggregationTypeEnum, CriterionType, DynamicThresholdOperator, DynamicThresholdSensitivity, @@ -113,7 +113,7 @@ 'VoiceReceiver', 'WebhookReceiver', 'WebtestLocationAvailabilityCriteria', - 'AggregationType', + 'AggregationTypeEnum', 'CriterionType', 'DynamicThresholdOperator', 'DynamicThresholdSensitivity', diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py index 71bcd9cc55e57..91ffe1ef15911 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py @@ -339,7 +339,7 @@ class MultiMetricCriteria(msrest.serialization.Model): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -403,7 +403,7 @@ class DynamicMetricCriteria(MultiMetricCriteria): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -786,14 +786,14 @@ class MetricAlertResource(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param description: Required. the description of the metric alert that will be included in the - alert email. + :param description: the description of the metric alert that will be included in the alert + email. :type description: str :param severity: Required. Alert severity {0, 1, 2, 3, 4}. :type severity: int :param enabled: Required. the flag that indicates whether the metric alert is enabled. :type enabled: bool - :param scopes: the list of resource id's that this metric alert is scoped to. + :param scopes: Required. the list of resource id's that this metric alert is scoped to. :type scopes: list[str] :param evaluation_frequency: Required. how often the metric alert is evaluated represented in ISO 8601 duration format. @@ -817,6 +817,8 @@ class MetricAlertResource(Resource): :type actions: list[~$(python-base-namespace).v2018_03_01.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: ~datetime.datetime + :ivar is_migrated: the value indicating whether this alert rule is migrated. + :vartype is_migrated: str """ _validation = { @@ -824,13 +826,14 @@ class MetricAlertResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'description': {'required': True}, 'severity': {'required': True}, 'enabled': {'required': True}, + 'scopes': {'required': True}, 'evaluation_frequency': {'required': True}, 'window_size': {'required': True}, 'criteria': {'required': True}, 'last_updated_time': {'readonly': True}, + 'is_migrated': {'readonly': True}, } _attribute_map = { @@ -851,6 +854,7 @@ class MetricAlertResource(Resource): 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'is_migrated': {'key': 'properties.isMigrated', 'type': 'str'}, } def __init__( @@ -858,10 +862,10 @@ def __init__( **kwargs ): super(MetricAlertResource, self).__init__(**kwargs) - self.description = kwargs['description'] + self.description = kwargs.get('description', None) self.severity = kwargs['severity'] self.enabled = kwargs['enabled'] - self.scopes = kwargs.get('scopes', None) + self.scopes = kwargs['scopes'] self.evaluation_frequency = kwargs['evaluation_frequency'] self.window_size = kwargs['window_size'] self.target_resource_type = kwargs.get('target_resource_type', None) @@ -870,6 +874,7 @@ def __init__( self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None + self.is_migrated = None class MetricAlertResourceCollection(msrest.serialization.Model): @@ -929,10 +934,13 @@ class MetricAlertResourcePatch(msrest.serialization.Model): :type actions: list[~$(python-base-namespace).v2018_03_01.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: ~datetime.datetime + :ivar is_migrated: the value indicating whether this alert rule is migrated. + :vartype is_migrated: str """ _validation = { 'last_updated_time': {'readonly': True}, + 'is_migrated': {'readonly': True}, } _attribute_map = { @@ -949,6 +957,7 @@ class MetricAlertResourcePatch(msrest.serialization.Model): 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'is_migrated': {'key': 'properties.isMigrated', 'type': 'str'}, } def __init__( @@ -969,6 +978,7 @@ def __init__( self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None + self.is_migrated = None class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): @@ -1104,7 +1114,7 @@ class MetricCriteria(MultiMetricCriteria): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py index 71c354aaab1af..2555711271b14 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py @@ -382,7 +382,7 @@ class MultiMetricCriteria(msrest.serialization.Model): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -417,7 +417,7 @@ def __init__( *, name: str, metric_name: str, - time_aggregation: Union[str, "AggregationType"], + time_aggregation: Union[str, "AggregationTypeEnum"], additional_properties: Optional[Dict[str, object]] = None, metric_namespace: Optional[str] = None, dimensions: Optional[List["MetricDimension"]] = None, @@ -454,7 +454,7 @@ class DynamicMetricCriteria(MultiMetricCriteria): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -507,7 +507,7 @@ def __init__( *, name: str, metric_name: str, - time_aggregation: Union[str, "AggregationType"], + time_aggregation: Union[str, "AggregationTypeEnum"], operator: Union[str, "DynamicThresholdOperator"], alert_sensitivity: Union[str, "DynamicThresholdSensitivity"], failing_periods: "DynamicThresholdFailingPeriods", @@ -878,14 +878,14 @@ class MetricAlertResource(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param description: Required. the description of the metric alert that will be included in the - alert email. + :param description: the description of the metric alert that will be included in the alert + email. :type description: str :param severity: Required. Alert severity {0, 1, 2, 3, 4}. :type severity: int :param enabled: Required. the flag that indicates whether the metric alert is enabled. :type enabled: bool - :param scopes: the list of resource id's that this metric alert is scoped to. + :param scopes: Required. the list of resource id's that this metric alert is scoped to. :type scopes: list[str] :param evaluation_frequency: Required. how often the metric alert is evaluated represented in ISO 8601 duration format. @@ -909,6 +909,8 @@ class MetricAlertResource(Resource): :type actions: list[~$(python-base-namespace).v2018_03_01.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: ~datetime.datetime + :ivar is_migrated: the value indicating whether this alert rule is migrated. + :vartype is_migrated: str """ _validation = { @@ -916,13 +918,14 @@ class MetricAlertResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'description': {'required': True}, 'severity': {'required': True}, 'enabled': {'required': True}, + 'scopes': {'required': True}, 'evaluation_frequency': {'required': True}, 'window_size': {'required': True}, 'criteria': {'required': True}, 'last_updated_time': {'readonly': True}, + 'is_migrated': {'readonly': True}, } _attribute_map = { @@ -943,20 +946,21 @@ class MetricAlertResource(Resource): 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'is_migrated': {'key': 'properties.isMigrated', 'type': 'str'}, } def __init__( self, *, location: str, - description: str, severity: int, enabled: bool, + scopes: List[str], evaluation_frequency: datetime.timedelta, window_size: datetime.timedelta, criteria: "MetricAlertCriteria", tags: Optional[Dict[str, str]] = None, - scopes: Optional[List[str]] = None, + description: Optional[str] = None, target_resource_type: Optional[str] = None, target_resource_region: Optional[str] = None, auto_mitigate: Optional[bool] = None, @@ -976,6 +980,7 @@ def __init__( self.auto_mitigate = auto_mitigate self.actions = actions self.last_updated_time = None + self.is_migrated = None class MetricAlertResourceCollection(msrest.serialization.Model): @@ -1037,10 +1042,13 @@ class MetricAlertResourcePatch(msrest.serialization.Model): :type actions: list[~$(python-base-namespace).v2018_03_01.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: ~datetime.datetime + :ivar is_migrated: the value indicating whether this alert rule is migrated. + :vartype is_migrated: str """ _validation = { 'last_updated_time': {'readonly': True}, + 'is_migrated': {'readonly': True}, } _attribute_map = { @@ -1057,6 +1065,7 @@ class MetricAlertResourcePatch(msrest.serialization.Model): 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'is_migrated': {'key': 'properties.isMigrated', 'type': 'str'}, } def __init__( @@ -1090,6 +1099,7 @@ def __init__( self.auto_mitigate = auto_mitigate self.actions = actions self.last_updated_time = None + self.is_migrated = None class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): @@ -1239,7 +1249,7 @@ class MetricCriteria(MultiMetricCriteria): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -1279,7 +1289,7 @@ def __init__( *, name: str, metric_name: str, - time_aggregation: Union[str, "AggregationType"], + time_aggregation: Union[str, "AggregationTypeEnum"], operator: Union[str, "Operator"], threshold: float, additional_properties: Optional[Dict[str, object]] = None, diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_client_enums.py index 974c2895a8cb3..8e62d4320379b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_client_enums.py @@ -26,7 +26,7 @@ def __getattr__(cls, name): raise AttributeError(name) -class AggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AggregationTypeEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """the criteria time aggregation types. """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py index e3123cfd1b688..2136919981569 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ActionGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str action_group_name, # type: str - action_group, # type: "models.ActionGroupResource" + action_group, # type: "_models.ActionGroupResource" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2018_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -123,7 +123,7 @@ def get( action_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Get an action group. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ def get( :rtype: ~$(python-base-namespace).v2018_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -238,10 +238,10 @@ def update( self, resource_group_name, # type: str action_group_name, # type: str - action_group_patch, # type: "models.ActionGroupPatchBody" + action_group_patch, # type: "_models.ActionGroupPatchBody" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -255,7 +255,7 @@ def update( :rtype: ~$(python-base-namespace).v2018_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -306,7 +306,7 @@ def list_by_subscription_id( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -314,7 +314,7 @@ def list_by_subscription_id( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -375,7 +375,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -385,7 +385,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -446,7 +446,7 @@ def enable_receiver( self, resource_group_name, # type: str action_group_name, # type: str - enable_request, # type: "models.EnableRequest" + enable_request, # type: "_models.EnableRequest" **kwargs # type: Any ): # type: (...) -> None @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py index c5ad151d7ce1b..4fa5737e2e213 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricAlertsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricAlertResourceCollection"] + # type: (...) -> Iterable["_models.MetricAlertResourceCollection"] """Retrieve alert rule definitions in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_03_01.models.MetricAlertResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -74,7 +74,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -102,7 +102,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -118,7 +118,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricAlertResourceCollection"] + # type: (...) -> Iterable["_models.MetricAlertResourceCollection"] """Retrieve alert rule definitions in a resource group. :param resource_group_name: The name of the resource group. @@ -128,7 +128,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_03_01.models.MetricAlertResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -145,7 +145,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -174,7 +174,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -191,7 +191,7 @@ def get( rule_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.MetricAlertResource" + # type: (...) -> "_models.MetricAlertResource" """Retrieve an alert rule definition. :param resource_group_name: The name of the resource group. @@ -203,7 +203,7 @@ def get( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -214,7 +214,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -234,7 +234,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -249,10 +249,10 @@ def create_or_update( self, resource_group_name, # type: str rule_name, # type: str - parameters, # type: "models.MetricAlertResource" + parameters, # type: "_models.MetricAlertResource" **kwargs # type: Any ): - # type: (...) -> "models.MetricAlertResource" + # type: (...) -> "_models.MetricAlertResource" """Create or update an metric alert definition. :param resource_group_name: The name of the resource group. @@ -266,7 +266,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -278,7 +278,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -302,7 +302,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -317,10 +317,10 @@ def update( self, resource_group_name, # type: str rule_name, # type: str - parameters, # type: "models.MetricAlertResourcePatch" + parameters, # type: "_models.MetricAlertResourcePatch" **kwargs # type: Any ): - # type: (...) -> "models.MetricAlertResource" + # type: (...) -> "_models.MetricAlertResource" """Update an metric alert definition. :param resource_group_name: The name of the resource group. @@ -334,7 +334,7 @@ def update( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -346,7 +346,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -370,7 +370,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -405,11 +405,12 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-03-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -421,6 +422,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -428,7 +430,8 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py index 605a407e5c61d..2741282189ff3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class MetricAlertsStatusOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list( rule_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.MetricAlertStatusCollection" + # type: (...) -> "_models.MetricAlertStatusCollection" """Retrieve an alert rule status. :param resource_group_name: The name of the resource group. @@ -62,7 +62,7 @@ def list( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertStatusCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertStatusCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertStatusCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -73,7 +73,7 @@ def list( # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -93,7 +93,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertStatusCollection', pipeline_response) @@ -111,7 +111,7 @@ def list_by_name( status_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.MetricAlertStatusCollection" + # type: (...) -> "_models.MetricAlertStatusCollection" """Retrieve an alert rule status. :param resource_group_name: The name of the resource group. @@ -125,7 +125,7 @@ def list_by_name( :rtype: ~$(python-base-namespace).v2018_03_01.models.MetricAlertStatusCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricAlertStatusCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertStatusCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -136,7 +136,7 @@ def list_by_name( # Construct URL url = self.list_by_name.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), 'statusName': self._serialize.url("status_name", status_name, 'str'), @@ -157,7 +157,7 @@ def list_by_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertStatusCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py index 057a1701351fd..57c1f46a36c58 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-04-16" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json index fb33a5064fd05..09db871cd6ac0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_client.py index f79b4be96052c..a792f5f4a951a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_client.py @@ -29,7 +29,7 @@ class MonitorClient(object): :vartype scheduled_query_rules: $(python-base-namespace).v2018_04_16.operations.ScheduledQueryRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -49,7 +49,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.scheduled_query_rules = ScheduledQueryRulesOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py index ca313cc14b8a4..e84103f20bf38 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-04-16" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_client.py index d720ac96d6704..b6702dcf88bfb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_client.py @@ -27,7 +27,7 @@ class MonitorClient(object): :vartype scheduled_query_rules: $(python-base-namespace).v2018_04_16.aio.operations.ScheduledQueryRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.scheduled_query_rules = ScheduledQueryRulesOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py index 05fe997303bc6..f71ebee3eeb6f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ScheduledQueryRulesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, rule_name: str, - parameters: "models.LogSearchRuleResource", + parameters: "_models.LogSearchRuleResource", **kwargs - ) -> "models.LogSearchRuleResource": + ) -> "_models.LogSearchRuleResource": """Creates or updates an log search rule. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -73,7 +73,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( resource_group_name: str, rule_name: str, **kwargs - ) -> "models.LogSearchRuleResource": + ) -> "_models.LogSearchRuleResource": """Gets an Log Search rule. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ async def get( :rtype: ~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -175,9 +175,9 @@ async def update( self, resource_group_name: str, rule_name: str, - parameters: "models.LogSearchRuleResourcePatch", + parameters: "_models.LogSearchRuleResourcePatch", **kwargs - ) -> "models.LogSearchRuleResource": + ) -> "_models.LogSearchRuleResource": """Update log search Rule. :param resource_group_name: The name of the resource group. @@ -191,7 +191,7 @@ async def update( :rtype: ~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -203,7 +203,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -227,7 +227,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -268,7 +268,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -286,7 +286,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -298,7 +298,7 @@ def list_by_subscription( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.LogSearchRuleResourceCollection"]: + ) -> AsyncIterable["_models.LogSearchRuleResourceCollection"]: """List the Log Search rules within a subscription group. :param filter: The filter to apply on the operation. For more information please see @@ -309,7 +309,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -326,7 +326,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -356,7 +356,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -372,7 +372,7 @@ def list_by_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.LogSearchRuleResourceCollection"]: + ) -> AsyncIterable["_models.LogSearchRuleResourceCollection"]: """List the Log Search rules within a resource group. :param resource_group_name: The name of the resource group. @@ -385,7 +385,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -433,7 +433,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py index 190bb72db8dc1..2798b4ace5f31 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ScheduledQueryRulesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str rule_name, # type: str - parameters, # type: "models.LogSearchRuleResource" + parameters, # type: "_models.LogSearchRuleResource" **kwargs # type: Any ): - # type: (...) -> "models.LogSearchRuleResource" + # type: (...) -> "_models.LogSearchRuleResource" """Creates or updates an log search rule. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -78,7 +78,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -123,7 +123,7 @@ def get( rule_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.LogSearchRuleResource" + # type: (...) -> "_models.LogSearchRuleResource" """Gets an Log Search rule. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ def get( :rtype: ~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -181,10 +181,10 @@ def update( self, resource_group_name, # type: str rule_name, # type: str - parameters, # type: "models.LogSearchRuleResourcePatch" + parameters, # type: "_models.LogSearchRuleResourcePatch" **kwargs # type: Any ): - # type: (...) -> "models.LogSearchRuleResource" + # type: (...) -> "_models.LogSearchRuleResource" """Update log search Rule. :param resource_group_name: The name of the resource group. @@ -198,7 +198,7 @@ def update( :rtype: ~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -210,7 +210,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -234,7 +234,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -276,7 +276,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -294,7 +294,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -307,7 +307,7 @@ def list_by_subscription( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.LogSearchRuleResourceCollection"] + # type: (...) -> Iterable["_models.LogSearchRuleResourceCollection"] """List the Log Search rules within a subscription group. :param filter: The filter to apply on the operation. For more information please see @@ -318,7 +318,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -335,7 +335,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -365,7 +365,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -382,7 +382,7 @@ def list_by_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.LogSearchRuleResourceCollection"] + # type: (...) -> Iterable["_models.LogSearchRuleResourceCollection"] """List the Log Search rules within a resource group. :param resource_group_name: The name of the resource group. @@ -395,7 +395,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LogSearchRuleResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -413,7 +413,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -443,7 +443,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py index 5ac948acf27a6..5d0e9fab4ebe7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-06-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json index 04a8308bde250..3fb8560e260d9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_client.py index 4c51e4bdb45e6..16554184d341d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_client.py @@ -32,7 +32,7 @@ class MonitorClient(object): :vartype guest_diagnostics_settings: $(python-base-namespace).v2018_06_01_preview.operations.GuestDiagnosticsSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -52,7 +52,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.guest_diagnostics_settings_association = GuestDiagnosticsSettingsAssociationOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py index 169f07e9f2e80..969801767a013 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-06-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_client.py index 9210c25c55154..bd0486fad72fc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_client.py @@ -30,7 +30,7 @@ class MonitorClient(object): :vartype guest_diagnostics_settings: $(python-base-namespace).v2018_06_01_preview.aio.operations.GuestDiagnosticsSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -49,7 +49,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.guest_diagnostics_settings_association = GuestDiagnosticsSettingsAssociationOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py index 1b1ebe3f7d3e0..6050896e0fac2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class GuestDiagnosticsSettingsAssociationOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_uri: str, association_name: str, - diagnostic_settings_association: "models.GuestDiagnosticSettingsAssociationResource", + diagnostic_settings_association: "_models.GuestDiagnosticSettingsAssociationResource", **kwargs - ) -> "models.GuestDiagnosticSettingsAssociationResource": + ) -> "_models.GuestDiagnosticSettingsAssociationResource": """Creates or updates guest diagnostics settings association. :param resource_uri: The fully qualified ID of the resource, including the resource name and @@ -63,7 +63,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -98,7 +98,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -118,7 +118,7 @@ async def get( resource_uri: str, association_name: str, **kwargs - ) -> "models.GuestDiagnosticSettingsAssociationResource": + ) -> "_models.GuestDiagnosticSettingsAssociationResource": """Gets guest diagnostics association settings. :param resource_uri: The fully qualified ID of the resource, including the resource name and @@ -131,7 +131,7 @@ async def get( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -220,7 +220,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -232,9 +232,9 @@ async def update( self, resource_uri: str, association_name: str, - parameters: "models.GuestDiagnosticSettingsAssociationResourcePatch", + parameters: "_models.GuestDiagnosticSettingsAssociationResourcePatch", **kwargs - ) -> "models.GuestDiagnosticSettingsAssociationResource": + ) -> "_models.GuestDiagnosticSettingsAssociationResource": """Updates an existing guestDiagnosticsSettingsAssociation Resource. To update other fields use the CreateOrUpdate method. @@ -250,7 +250,7 @@ async def update( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -285,7 +285,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -299,7 +299,7 @@ async def update( def list( self, **kwargs - ) -> AsyncIterable["models.GuestDiagnosticSettingsAssociationList"]: + ) -> AsyncIterable["_models.GuestDiagnosticSettingsAssociationList"]: """Get a list of all guest diagnostic settings association in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -307,7 +307,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -324,7 +324,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -352,7 +352,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -367,7 +367,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.GuestDiagnosticSettingsAssociationList"]: + ) -> AsyncIterable["_models.GuestDiagnosticSettingsAssociationList"]: """Get a list of all guest diagnostic settings association in a resource group. :param resource_group_name: The name of the resource group. @@ -377,7 +377,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,7 +395,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -423,7 +423,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py index 0d71030a2a171..0f36472724cf8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class GuestDiagnosticsSettingsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, diagnostic_settings_name: str, - diagnostic_settings: "models.GuestDiagnosticSettingsResource", + diagnostic_settings: "_models.GuestDiagnosticSettingsResource", **kwargs - ) -> "models.GuestDiagnosticSettingsResource": + ) -> "_models.GuestDiagnosticSettingsResource": """Creates or updates guest diagnostics settings. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( resource_group_name: str, diagnostic_settings_name: str, **kwargs - ) -> "models.GuestDiagnosticSettingsResource": + ) -> "_models.GuestDiagnosticSettingsResource": """Gets guest diagnostics settings. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ async def get( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsResource', pipeline_response) @@ -175,9 +175,9 @@ async def update( self, resource_group_name: str, diagnostic_settings_name: str, - parameters: "models.GuestDiagnosticSettingsPatchResource", + parameters: "_models.GuestDiagnosticSettingsPatchResource", **kwargs - ) -> "models.GuestDiagnosticSettingsResource": + ) -> "_models.GuestDiagnosticSettingsResource": """Updates guest diagnostics settings. :param resource_group_name: The name of the resource group. @@ -191,7 +191,7 @@ async def update( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -205,7 +205,7 @@ async def update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -227,7 +227,7 @@ async def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -272,7 +272,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -290,7 +290,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -301,7 +301,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.GuestDiagnosticSettingsList"]: + ) -> AsyncIterable["_models.GuestDiagnosticSettingsList"]: """Get a list of all guest diagnostic settings in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -309,7 +309,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -326,7 +326,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -354,7 +354,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -369,7 +369,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.GuestDiagnosticSettingsList"]: + ) -> AsyncIterable["_models.GuestDiagnosticSettingsList"]: """Get a list of all guest diagnostic settings in a resource group. :param resource_group_name: The name of the resource group. @@ -379,7 +379,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -397,7 +397,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -425,7 +425,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py index c730084dc51ce..d312dee8235e2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class GuestDiagnosticsSettingsAssociationOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_uri, # type: str association_name, # type: str - diagnostic_settings_association, # type: "models.GuestDiagnosticSettingsAssociationResource" + diagnostic_settings_association, # type: "_models.GuestDiagnosticSettingsAssociationResource" **kwargs # type: Any ): - # type: (...) -> "models.GuestDiagnosticSettingsAssociationResource" + # type: (...) -> "_models.GuestDiagnosticSettingsAssociationResource" """Creates or updates guest diagnostics settings association. :param resource_uri: The fully qualified ID of the resource, including the resource name and @@ -68,7 +68,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -103,7 +103,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -124,7 +124,7 @@ def get( association_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GuestDiagnosticSettingsAssociationResource" + # type: (...) -> "_models.GuestDiagnosticSettingsAssociationResource" """Gets guest diagnostics association settings. :param resource_uri: The fully qualified ID of the resource, including the resource name and @@ -137,7 +137,7 @@ def get( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -227,7 +227,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -239,10 +239,10 @@ def update( self, resource_uri, # type: str association_name, # type: str - parameters, # type: "models.GuestDiagnosticSettingsAssociationResourcePatch" + parameters, # type: "_models.GuestDiagnosticSettingsAssociationResourcePatch" **kwargs # type: Any ): - # type: (...) -> "models.GuestDiagnosticSettingsAssociationResource" + # type: (...) -> "_models.GuestDiagnosticSettingsAssociationResource" """Updates an existing guestDiagnosticsSettingsAssociation Resource. To update other fields use the CreateOrUpdate method. @@ -258,7 +258,7 @@ def update( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -293,7 +293,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -308,7 +308,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.GuestDiagnosticSettingsAssociationList"] + # type: (...) -> Iterable["_models.GuestDiagnosticSettingsAssociationList"] """Get a list of all guest diagnostic settings association in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -316,7 +316,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -333,7 +333,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -361,7 +361,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -377,7 +377,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.GuestDiagnosticSettingsAssociationList"] + # type: (...) -> Iterable["_models.GuestDiagnosticSettingsAssociationList"] """Get a list of all guest diagnostic settings association in a resource group. :param resource_group_name: The name of the resource group. @@ -387,7 +387,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsAssociationList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -405,7 +405,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -433,7 +433,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py index 67a7f766c3e8f..8fd1f62c36cab 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class GuestDiagnosticsSettingsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str diagnostic_settings_name, # type: str - diagnostic_settings, # type: "models.GuestDiagnosticSettingsResource" + diagnostic_settings, # type: "_models.GuestDiagnosticSettingsResource" **kwargs # type: Any ): - # type: (...) -> "models.GuestDiagnosticSettingsResource" + # type: (...) -> "_models.GuestDiagnosticSettingsResource" """Creates or updates guest diagnostics settings. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -123,7 +123,7 @@ def get( diagnostic_settings_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GuestDiagnosticSettingsResource" + # type: (...) -> "_models.GuestDiagnosticSettingsResource" """Gets guest diagnostics settings. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ def get( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsResource', pipeline_response) @@ -181,10 +181,10 @@ def update( self, resource_group_name, # type: str diagnostic_settings_name, # type: str - parameters, # type: "models.GuestDiagnosticSettingsPatchResource" + parameters, # type: "_models.GuestDiagnosticSettingsPatchResource" **kwargs # type: Any ): - # type: (...) -> "models.GuestDiagnosticSettingsResource" + # type: (...) -> "_models.GuestDiagnosticSettingsResource" """Updates guest diagnostics settings. :param resource_group_name: The name of the resource group. @@ -198,7 +198,7 @@ def update( :rtype: ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -212,7 +212,7 @@ def update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -234,7 +234,7 @@ def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -280,7 +280,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -298,7 +298,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -310,7 +310,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.GuestDiagnosticSettingsList"] + # type: (...) -> Iterable["_models.GuestDiagnosticSettingsList"] """Get a list of all guest diagnostic settings in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -318,7 +318,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -335,7 +335,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -363,7 +363,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -379,7 +379,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.GuestDiagnosticSettingsList"] + # type: (...) -> Iterable["_models.GuestDiagnosticSettingsList"] """Get a list of all guest diagnostic settings in a resource group. :param resource_group_name: The name of the resource group. @@ -389,7 +389,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GuestDiagnosticSettingsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -407,7 +407,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -435,7 +435,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py index 37323d0126ed3..7713d61e810de 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-09-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json index 3e61eec803470..3c32df8a2ba98 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_client.py index 425ab6863cfa9..159b10691c384 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_client.py @@ -35,7 +35,7 @@ class MonitorClient(object): :vartype baseline: $(python-base-namespace).v2018_09_01.operations.BaselineOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -55,7 +55,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py index eed1aaa61ef21..2999ac5f0c4f9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-09-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_client.py index 5549ee3ad4c34..8150890549f39 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_client.py @@ -33,7 +33,7 @@ class MonitorClient(object): :vartype baseline: $(python-base-namespace).v2018_09_01.aio.operations.BaselineOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -52,7 +52,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py index df135300c0d2e..0a47034cd1b91 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ActionGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, action_group_name: str, - action_group: "models.ActionGroupResource", + action_group: "_models.ActionGroupResource", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2018_09_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( resource_group_name: str, action_group_name: str, **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Get an action group. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ async def get( :rtype: ~$(python-base-namespace).v2018_09_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -231,9 +231,9 @@ async def update( self, resource_group_name: str, action_group_name: str, - action_group_patch: "models.ActionGroupPatchBody", + action_group_patch: "_models.ActionGroupPatchBody", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -247,7 +247,7 @@ async def update( :rtype: ~$(python-base-namespace).v2018_09_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -297,7 +297,7 @@ async def update( def list_by_subscription_id( self, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -305,7 +305,7 @@ def list_by_subscription_id( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -365,7 +365,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -375,7 +375,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -436,7 +436,7 @@ async def enable_receiver( self, resource_group_name: str, action_group_name: str, - enable_request: "models.EnableRequest", + enable_request: "_models.EnableRequest", **kwargs ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py index a1e357bac8155..7f16e9be2a851 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class BaselineOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,11 +49,11 @@ async def get( interval: Optional[datetime.timedelta] = None, aggregation: Optional[str] = None, sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "models.ResultType"]] = None, + result_type: Optional[Union[str, "_models.ResultType"]] = None, metricnamespace: Optional[str] = None, filter: Optional[str] = None, **kwargs - ) -> "models.BaselineResponse": + ) -> "_models.BaselineResponse": """**Gets the baseline values for a resource**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -85,7 +85,7 @@ async def get( :rtype: ~$(python-base-namespace).v2018_09_01.models.BaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.BaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -130,7 +130,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -139,4 +139,4 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py index b3b9cd22981fa..8f208124673b8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class MetricBaselineOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,11 +49,11 @@ async def get( interval: Optional[datetime.timedelta] = None, aggregation: Optional[str] = None, sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "models.ResultType"]] = None, + result_type: Optional[Union[str, "_models.ResultType"]] = None, metricnamespace: Optional[str] = None, filter: Optional[str] = None, **kwargs - ) -> "models.BaselineResponse": + ) -> "_models.BaselineResponse": """**Gets the baseline values for a specific metric**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -85,7 +85,7 @@ async def get( :rtype: ~$(python-base-namespace).v2018_09_01.models.BaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.BaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -129,7 +129,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -138,14 +138,14 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore async def calculate_baseline( self, resource_uri: str, - time_series_information: "models.TimeSeriesInformation", + time_series_information: "_models.TimeSeriesInformation", **kwargs - ) -> "models.CalculateBaselineResponse": + ) -> "_models.CalculateBaselineResponse": """**Lists the baseline values for a resource**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -161,7 +161,7 @@ async def calculate_baseline( :rtype: ~$(python-base-namespace).v2018_09_01.models.CalculateBaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CalculateBaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateBaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -195,7 +195,7 @@ async def calculate_baseline( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) @@ -204,4 +204,4 @@ async def calculate_baseline( return cls(pipeline_response, deserialized, {}) return deserialized - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/calculatebaseline'} # type: ignore + calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py index 15637430cdd18..8b4cb9e3e4356 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py @@ -18,6 +18,7 @@ from ._models_py3 import BaselineMetadataValue from ._models_py3 import BaselineResponse from ._models_py3 import CalculateBaselineResponse + from ._models_py3 import CalculateBaselineResponseStatistics from ._models_py3 import EmailReceiver from ._models_py3 import EnableRequest from ._models_py3 import ErrorResponse @@ -41,6 +42,7 @@ from ._models import BaselineMetadataValue # type: ignore from ._models import BaselineResponse # type: ignore from ._models import CalculateBaselineResponse # type: ignore + from ._models import CalculateBaselineResponseStatistics # type: ignore from ._models import EmailReceiver # type: ignore from ._models import EnableRequest # type: ignore from ._models import ErrorResponse # type: ignore @@ -71,6 +73,7 @@ 'BaselineMetadataValue', 'BaselineResponse', 'CalculateBaselineResponse', + 'CalculateBaselineResponseStatistics', 'EmailReceiver', 'EnableRequest', 'ErrorResponse', diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py index 8ffeb77fca187..4e070d55c4562 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py @@ -365,6 +365,8 @@ class Baseline(msrest.serialization.Model): :type low_thresholds: list[float] :param high_thresholds: Required. The high thresholds of the baseline. :type high_thresholds: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] """ _validation = { @@ -377,6 +379,7 @@ class Baseline(msrest.serialization.Model): 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, } def __init__( @@ -387,6 +390,7 @@ def __init__( self.sensitivity = kwargs['sensitivity'] self.low_thresholds = kwargs['low_thresholds'] self.high_thresholds = kwargs['high_thresholds'] + self.timestamps = kwargs.get('timestamps', None) class BaselineMetadataValue(msrest.serialization.Model): @@ -486,6 +490,9 @@ class CalculateBaselineResponse(msrest.serialization.Model): :type timestamps: list[~datetime.datetime] :param baseline: Required. The baseline values for each sensitivity. :type baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] + :param statistics: The statistics. + :type statistics: ~$(python-base- + namespace).v2018_09_01.models.CalculateBaselineResponseStatistics """ _validation = { @@ -497,6 +504,7 @@ class CalculateBaselineResponse(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + 'statistics': {'key': 'statistics', 'type': 'CalculateBaselineResponseStatistics'}, } def __init__( @@ -507,6 +515,34 @@ def __init__( self.type = kwargs['type'] self.timestamps = kwargs.get('timestamps', None) self.baseline = kwargs['baseline'] + self.statistics = kwargs.get('statistics', None) + + +class CalculateBaselineResponseStatistics(msrest.serialization.Model): + """The statistics. + + :param is_eligible: is series eligible for dynamic threshold analysis. + :type is_eligible: str + :param status: The list of extended status for calculating the baseline. + :type status: list[str] + :param seasonality_period: The seasonality period for calculating the baseline. + :type seasonality_period: int + """ + + _attribute_map = { + 'is_eligible': {'key': 'isEligible', 'type': 'str'}, + 'status': {'key': 'status', 'type': '[str]'}, + 'seasonality_period': {'key': 'seasonalityPeriod', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(CalculateBaselineResponseStatistics, self).__init__(**kwargs) + self.is_eligible = kwargs.get('is_eligible', None) + self.status = kwargs.get('status', None) + self.seasonality_period = kwargs.get('seasonality_period', None) class EmailReceiver(msrest.serialization.Model): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py index 98a4c85654c9c..8df9c331d63b6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py @@ -412,6 +412,8 @@ class Baseline(msrest.serialization.Model): :type low_thresholds: list[float] :param high_thresholds: Required. The high thresholds of the baseline. :type high_thresholds: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] """ _validation = { @@ -424,6 +426,7 @@ class Baseline(msrest.serialization.Model): 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, } def __init__( @@ -432,12 +435,14 @@ def __init__( sensitivity: Union[str, "Sensitivity"], low_thresholds: List[float], high_thresholds: List[float], + timestamps: Optional[List[datetime.datetime]] = None, **kwargs ): super(Baseline, self).__init__(**kwargs) self.sensitivity = sensitivity self.low_thresholds = low_thresholds self.high_thresholds = high_thresholds + self.timestamps = timestamps class BaselineMetadataValue(msrest.serialization.Model): @@ -547,6 +552,9 @@ class CalculateBaselineResponse(msrest.serialization.Model): :type timestamps: list[~datetime.datetime] :param baseline: Required. The baseline values for each sensitivity. :type baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] + :param statistics: The statistics. + :type statistics: ~$(python-base- + namespace).v2018_09_01.models.CalculateBaselineResponseStatistics """ _validation = { @@ -558,6 +566,7 @@ class CalculateBaselineResponse(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + 'statistics': {'key': 'statistics', 'type': 'CalculateBaselineResponseStatistics'}, } def __init__( @@ -566,12 +575,45 @@ def __init__( type: str, baseline: List["Baseline"], timestamps: Optional[List[datetime.datetime]] = None, + statistics: Optional["CalculateBaselineResponseStatistics"] = None, **kwargs ): super(CalculateBaselineResponse, self).__init__(**kwargs) self.type = type self.timestamps = timestamps self.baseline = baseline + self.statistics = statistics + + +class CalculateBaselineResponseStatistics(msrest.serialization.Model): + """The statistics. + + :param is_eligible: is series eligible for dynamic threshold analysis. + :type is_eligible: str + :param status: The list of extended status for calculating the baseline. + :type status: list[str] + :param seasonality_period: The seasonality period for calculating the baseline. + :type seasonality_period: int + """ + + _attribute_map = { + 'is_eligible': {'key': 'isEligible', 'type': 'str'}, + 'status': {'key': 'status', 'type': '[str]'}, + 'seasonality_period': {'key': 'seasonalityPeriod', 'type': 'int'}, + } + + def __init__( + self, + *, + is_eligible: Optional[str] = None, + status: Optional[List[str]] = None, + seasonality_period: Optional[int] = None, + **kwargs + ): + super(CalculateBaselineResponseStatistics, self).__init__(**kwargs) + self.is_eligible = is_eligible + self.status = status + self.seasonality_period = seasonality_period class EmailReceiver(msrest.serialization.Model): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py index 027d0716ac1af..e2d74663633c9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ActionGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str action_group_name, # type: str - action_group, # type: "models.ActionGroupResource" + action_group, # type: "_models.ActionGroupResource" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2018_09_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -123,7 +123,7 @@ def get( action_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Get an action group. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ def get( :rtype: ~$(python-base-namespace).v2018_09_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -238,10 +238,10 @@ def update( self, resource_group_name, # type: str action_group_name, # type: str - action_group_patch, # type: "models.ActionGroupPatchBody" + action_group_patch, # type: "_models.ActionGroupPatchBody" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -255,7 +255,7 @@ def update( :rtype: ~$(python-base-namespace).v2018_09_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -306,7 +306,7 @@ def list_by_subscription_id( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -314,7 +314,7 @@ def list_by_subscription_id( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -375,7 +375,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -385,7 +385,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -446,7 +446,7 @@ def enable_receiver( self, resource_group_name, # type: str action_group_name, # type: str - enable_request, # type: "models.EnableRequest" + enable_request, # type: "_models.EnableRequest" **kwargs # type: Any ): # type: (...) -> None @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py index 95712395f509e..5ff644b7d4eda 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class BaselineOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,12 +53,12 @@ def get( interval=None, # type: Optional[datetime.timedelta] aggregation=None, # type: Optional[str] sensitivities=None, # type: Optional[str] - result_type=None, # type: Optional[Union[str, "models.ResultType"]] + result_type=None, # type: Optional[Union[str, "_models.ResultType"]] metricnamespace=None, # type: Optional[str] filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.BaselineResponse" + # type: (...) -> "_models.BaselineResponse" """**Gets the baseline values for a resource**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -90,7 +90,7 @@ def get( :rtype: ~$(python-base-namespace).v2018_09_01.models.BaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.BaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -135,7 +135,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -144,4 +144,4 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py index b2cdb7bb6e428..1a4acd854d5f1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class MetricBaselineOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,12 +53,12 @@ def get( interval=None, # type: Optional[datetime.timedelta] aggregation=None, # type: Optional[str] sensitivities=None, # type: Optional[str] - result_type=None, # type: Optional[Union[str, "models.ResultType"]] + result_type=None, # type: Optional[Union[str, "_models.ResultType"]] metricnamespace=None, # type: Optional[str] filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.BaselineResponse" + # type: (...) -> "_models.BaselineResponse" """**Gets the baseline values for a specific metric**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -90,7 +90,7 @@ def get( :rtype: ~$(python-base-namespace).v2018_09_01.models.BaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.BaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -134,7 +134,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -143,15 +143,15 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore def calculate_baseline( self, resource_uri, # type: str - time_series_information, # type: "models.TimeSeriesInformation" + time_series_information, # type: "_models.TimeSeriesInformation" **kwargs # type: Any ): - # type: (...) -> "models.CalculateBaselineResponse" + # type: (...) -> "_models.CalculateBaselineResponse" """**Lists the baseline values for a resource**. :param resource_uri: The identifier of the resource. It has the following structure: @@ -167,7 +167,7 @@ def calculate_baseline( :rtype: ~$(python-base-namespace).v2018_09_01.models.CalculateBaselineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CalculateBaselineResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateBaselineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -201,7 +201,7 @@ def calculate_baseline( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) @@ -210,4 +210,4 @@ def calculate_baseline( return cls(pipeline_response, deserialized, {}) return deserialized - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/calculatebaseline'} # type: ignore + calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py index f9dcf79d380dc..5633dfdd4b07a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py @@ -43,7 +43,7 @@ def __init__( self.credential = credential self.api_version = "2018-11-27-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json index 904ce44141fbf..e8bd03081bb22 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_client.py index 3d0dfcc9d9d5a..fe69a0cda202f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_client.py @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vm_insights = VMInsightsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py index ebb294089737c..5a81e34b4d7af 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py @@ -40,7 +40,7 @@ def __init__( self.credential = credential self.api_version = "2018-11-27-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_client.py index 062436d432e40..3709f21b2721e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_client.py @@ -43,7 +43,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vm_insights = VMInsightsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py index f0d98fcfa390b..e79fd543f141b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class VMInsightsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ async def get_onboarding_status( self, resource_uri: str, **kwargs - ) -> "models.VMInsightsOnboardingStatus": + ) -> "_models.VMInsightsOnboardingStatus": """Retrieves the VM Insights onboarding status for the specified resource or resource scope. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource, or @@ -55,7 +55,7 @@ async def get_onboarding_status( :rtype: ~$(python-base-namespace).v2018_11_27_preview.models.VMInsightsOnboardingStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VMInsightsOnboardingStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VMInsightsOnboardingStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -84,7 +84,7 @@ async def get_onboarding_status( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResponseWithError, response) + error = self._deserialize(_models.ResponseWithError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VMInsightsOnboardingStatus', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py index a76ef6e7f3ce0..b2b629ba9c057 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class VMInsightsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def get_onboarding_status( resource_uri, # type: str **kwargs # type: Any ): - # type: (...) -> "models.VMInsightsOnboardingStatus" + # type: (...) -> "_models.VMInsightsOnboardingStatus" """Retrieves the VM Insights onboarding status for the specified resource or resource scope. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource, or @@ -60,7 +60,7 @@ def get_onboarding_status( :rtype: ~$(python-base-namespace).v2018_11_27_preview.models.VMInsightsOnboardingStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VMInsightsOnboardingStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VMInsightsOnboardingStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -89,7 +89,7 @@ def get_onboarding_status( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResponseWithError, response) + error = self._deserialize(_models.ResponseWithError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VMInsightsOnboardingStatus', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py index b745daf540470..ce0570b5023a9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2019-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json index 24a87bcac7c46..6ae28c52d4000 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_client.py index 694541caa5e98..845317cadcab6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_client.py @@ -32,7 +32,7 @@ class MonitorClient(object): :vartype baselines: $(python-base-namespace).v2019_03_01.operations.BaselinesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -52,7 +52,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py index 407068f252da7..8c5535947922d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2019-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_client.py index a02d6dfbcf12b..7143739948754 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_client.py @@ -30,7 +30,7 @@ class MonitorClient(object): :vartype baselines: $(python-base-namespace).v2019_03_01.aio.operations.BaselinesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -49,7 +49,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py index 71171f8d75e8f..494e0f68b863b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ActionGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, action_group_name: str, - action_group: "models.ActionGroupResource", + action_group: "_models.ActionGroupResource", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2019_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( resource_group_name: str, action_group_name: str, **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Get an action group. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ async def get( :rtype: ~$(python-base-namespace).v2019_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -231,9 +231,9 @@ async def update( self, resource_group_name: str, action_group_name: str, - action_group_patch: "models.ActionGroupPatchBody", + action_group_patch: "_models.ActionGroupPatchBody", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -247,7 +247,7 @@ async def update( :rtype: ~$(python-base-namespace).v2019_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -297,7 +297,7 @@ async def update( def list_by_subscription_id( self, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -305,7 +305,7 @@ def list_by_subscription_id( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -365,7 +365,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -375,7 +375,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -436,7 +436,7 @@ async def enable_receiver( self, resource_group_name: str, action_group_name: str, - enable_request: "models.EnableRequest", + enable_request: "_models.EnableRequest", **kwargs ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py index 1fbc07aa9dbc3..b4422cb6294f4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py @@ -15,7 +15,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class BaselinesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -52,9 +52,9 @@ def list( aggregation: Optional[str] = None, sensitivities: Optional[str] = None, filter: Optional[str] = None, - result_type: Optional[Union[str, "models.ResultType"]] = None, + result_type: Optional[Union[str, "_models.ResultType"]] = None, **kwargs - ) -> AsyncIterable["models.MetricBaselinesResponse"]: + ) -> AsyncIterable["_models.MetricBaselinesResponse"]: """**Lists the metric baseline values for a resource**. :param resource_uri: The identifier of the resource. @@ -90,7 +90,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_03_01.models.MetricBaselinesResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricBaselinesResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricBaselinesResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -151,7 +151,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -160,4 +160,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricBaselines'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricBaselines'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py index 51eb052aeaca5..2784128d35727 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ActionGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str action_group_name, # type: str - action_group, # type: "models.ActionGroupResource" + action_group, # type: "_models.ActionGroupResource" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2019_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -123,7 +123,7 @@ def get( action_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Get an action group. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ def get( :rtype: ~$(python-base-namespace).v2019_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -238,10 +238,10 @@ def update( self, resource_group_name, # type: str action_group_name, # type: str - action_group_patch, # type: "models.ActionGroupPatchBody" + action_group_patch, # type: "_models.ActionGroupPatchBody" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -255,7 +255,7 @@ def update( :rtype: ~$(python-base-namespace).v2019_03_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -306,7 +306,7 @@ def list_by_subscription_id( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -314,7 +314,7 @@ def list_by_subscription_id( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -375,7 +375,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -385,7 +385,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -446,7 +446,7 @@ def enable_receiver( self, resource_group_name, # type: str action_group_name, # type: str - enable_request, # type: "models.EnableRequest" + enable_request, # type: "_models.EnableRequest" **kwargs # type: Any ): # type: (...) -> None @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py index 9cd5ecd4ec9f3..fa732d8872809 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py @@ -15,7 +15,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class BaselinesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -56,10 +56,10 @@ def list( aggregation=None, # type: Optional[str] sensitivities=None, # type: Optional[str] filter=None, # type: Optional[str] - result_type=None, # type: Optional[Union[str, "models.ResultType"]] + result_type=None, # type: Optional[Union[str, "_models.ResultType"]] **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetricBaselinesResponse"] + # type: (...) -> Iterable["_models.MetricBaselinesResponse"] """**Lists the metric baseline values for a resource**. :param resource_uri: The identifier of the resource. @@ -95,7 +95,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_03_01.models.MetricBaselinesResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetricBaselinesResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricBaselinesResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -156,7 +156,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -165,4 +165,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricBaselines'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricBaselines'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py index e5a8708721ec1..a0c3b662aa507 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2019-06-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json index f4fd97631fd60..e6ff433e7106f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_client.py index 69d3e351d3036..eeea0925bb510 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_client.py @@ -29,7 +29,7 @@ class MonitorClient(object): :vartype action_groups: $(python-base-namespace).v2019_06_01.operations.ActionGroupsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -49,7 +49,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py index 4926cceb67f89..c808e76a91c94 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2019-06-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_client.py index 5e632bf1b35f2..e71723fc43ce3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_client.py @@ -27,7 +27,7 @@ class MonitorClient(object): :vartype action_groups: $(python-base-namespace).v2019_06_01.aio.operations.ActionGroupsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.action_groups = ActionGroupsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py index 011ea1f3e2c52..50450066d735a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ActionGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, action_group_name: str, - action_group: "models.ActionGroupResource", + action_group: "_models.ActionGroupResource", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2019_06_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( resource_group_name: str, action_group_name: str, **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Get an action group. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ async def get( :rtype: ~$(python-base-namespace).v2019_06_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -231,9 +231,9 @@ async def update( self, resource_group_name: str, action_group_name: str, - action_group_patch: "models.ActionGroupPatchBody", + action_group_patch: "_models.ActionGroupPatchBody", **kwargs - ) -> "models.ActionGroupResource": + ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -247,7 +247,7 @@ async def update( :rtype: ~$(python-base-namespace).v2019_06_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -297,7 +297,7 @@ async def update( def list_by_subscription_id( self, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -305,7 +305,7 @@ def list_by_subscription_id( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_06_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -365,7 +365,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.ActionGroupList"]: + ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -375,7 +375,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_06_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -436,7 +436,7 @@ async def enable_receiver( self, resource_group_name: str, action_group_name: str, - enable_request: "models.EnableRequest", + enable_request: "_models.EnableRequest", **kwargs ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py index 6ce83244aee85..124cb038deb75 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ActionGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str action_group_name, # type: str - action_group, # type: "models.ActionGroupResource" + action_group, # type: "_models.ActionGroupResource" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Create a new action group or update an existing one. :param resource_group_name: The name of the resource group. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2019_06_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -123,7 +123,7 @@ def get( action_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Get an action group. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ def get( :rtype: ~$(python-base-namespace).v2019_06_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -238,10 +238,10 @@ def update( self, resource_group_name, # type: str action_group_name, # type: str - action_group_patch, # type: "models.ActionGroupPatchBody" + action_group_patch, # type: "_models.ActionGroupPatchBody" **kwargs # type: Any ): - # type: (...) -> "models.ActionGroupResource" + # type: (...) -> "_models.ActionGroupResource" """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. :param resource_group_name: The name of the resource group. @@ -255,7 +255,7 @@ def update( :rtype: ~$(python-base-namespace).v2019_06_01.models.ActionGroupResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -306,7 +306,7 @@ def list_by_subscription_id( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -314,7 +314,7 @@ def list_by_subscription_id( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_06_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -375,7 +375,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionGroupList"] + # type: (...) -> Iterable["_models.ActionGroupList"] """Get a list of all action groups in a resource group. :param resource_group_name: The name of the resource group. @@ -385,7 +385,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_06_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionGroupList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -446,7 +446,7 @@ def enable_receiver( self, resource_group_name, # type: str action_group_name, # type: str - enable_request, # type: "models.EnableRequest" + enable_request, # type: "_models.EnableRequest" **kwargs # type: Any ): # type: (...) -> None @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py index ae5dc051a0ced..657970816bd01 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -49,7 +49,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2019-10-17-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json index db10af186408c..bfdea836bd8cd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_client.py index 7e250df0fab0d..f586875e4a69f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_client.py @@ -41,7 +41,7 @@ class MonitorClient(object): :vartype private_link_scoped_resources: $(python-base-namespace).v2019_10_17.operations.PrivateLinkScopedResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -62,7 +62,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.private_link_scopes = PrivateLinkScopesOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py index 21d6b4e30631d..4cfc739a8cccb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -46,7 +46,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2019-10-17-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_client.py index 17ff10edd5762..58a0b50bdbaf4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_client.py @@ -39,7 +39,7 @@ class MonitorClient(object): :vartype private_link_scoped_resources: $(python-base-namespace).v2019_10_17.aio.operations.PrivateLinkScopedResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -59,7 +59,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.private_link_scopes = PrivateLinkScopesOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py index b41712ae5507f..afff5949f540b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,7 +49,7 @@ async def get( scope_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_models.PrivateEndpointConnection": """Gets a private endpoint connection. :param resource_group_name: The name of the resource group. @@ -63,7 +63,7 @@ async def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -74,7 +74,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -110,10 +110,10 @@ async def _create_or_update_initial( resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, - parameters: "models.PrivateEndpointConnection", + parameters: "_models.PrivateEndpointConnection", **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -125,7 +125,7 @@ async def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -167,9 +167,9 @@ async def begin_create_or_update( resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, - parameters: "models.PrivateEndpointConnection", + parameters: "_models.PrivateEndpointConnection", **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Approve or reject a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. @@ -191,7 +191,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -217,7 +217,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -248,7 +255,7 @@ async def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -323,7 +330,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -342,7 +356,7 @@ def list_by_private_link_scope( resource_group_name: str, scope_name: str, **kwargs - ) -> AsyncIterable["models.PrivateEndpointConnectionListResult"]: + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: """Gets all private endpoint connections on a private link scope. :param resource_group_name: The name of the resource group. @@ -354,7 +368,7 @@ def list_by_private_link_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -371,7 +385,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py index 12fcc4dbf9965..b69c459190264 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def list_by_private_link_scope( resource_group_name: str, scope_name: str, **kwargs - ) -> AsyncIterable["models.PrivateLinkResourceListResult"]: + ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. :param resource_group_name: The name of the resource group. @@ -58,7 +58,7 @@ def list_by_private_link_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -75,7 +75,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } @@ -121,7 +121,7 @@ async def get( scope_name: str, group_name: str, **kwargs - ) -> "models.PrivateLinkResource": + ) -> "_models.PrivateLinkResource": """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. :param resource_group_name: The name of the resource group. @@ -135,7 +135,7 @@ async def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -146,7 +146,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'groupName': self._serialize.url("group_name", group_name, 'str'), diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py index 3243b12b7d98e..3910328d964ea 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkScopeOperationStatusOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def get( async_operation_id: str, resource_group_name: str, **kwargs - ) -> "models.OperationStatus": + ) -> "_models.OperationStatus": """Get the status of an azure asynchronous operation associated with a private link scope operation. @@ -58,7 +58,7 @@ async def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.OperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -71,7 +71,7 @@ async def get( path_format_arguments = { 'asyncOperationId': self._serialize.url("async_operation_id", async_operation_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py index 2ca14616f0fa8..85c7e4f6b1e66 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class PrivateLinkScopedResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,7 +49,7 @@ async def get( scope_name: str, name: str, **kwargs - ) -> "models.ScopedResource": + ) -> "_models.ScopedResource": """Gets a scoped resource in a private link scope. :param resource_group_name: The name of the resource group. @@ -63,7 +63,7 @@ async def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.ScopedResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScopedResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -74,7 +74,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -110,10 +110,10 @@ async def _create_or_update_initial( resource_group_name: str, scope_name: str, name: str, - parameters: "models.ScopedResource", + parameters: "_models.ScopedResource", **kwargs - ) -> Optional["models.ScopedResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ScopedResource"]] + ) -> Optional["_models.ScopedResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ScopedResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -125,7 +125,7 @@ async def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -170,9 +170,9 @@ async def begin_create_or_update( resource_group_name: str, scope_name: str, name: str, - parameters: "models.ScopedResource", + parameters: "_models.ScopedResource", **kwargs - ) -> AsyncLROPoller["models.ScopedResource"]: + ) -> AsyncLROPoller["_models.ScopedResource"]: """Approve or reject a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. @@ -194,7 +194,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ScopedResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -220,7 +220,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -251,7 +258,7 @@ async def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -326,7 +333,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -345,7 +359,7 @@ def list_by_private_link_scope( resource_group_name: str, scope_name: str, **kwargs - ) -> AsyncIterable["models.ScopedResourceListResult"]: + ) -> AsyncIterable["_models.ScopedResourceListResult"]: """Gets all private endpoint connections on a private link scope. :param resource_group_name: The name of the resource group. @@ -357,7 +371,7 @@ def list_by_private_link_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.ScopedResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScopedResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -374,7 +388,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py index 1ff852ac71bc9..be17b6f80a592 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class PrivateLinkScopesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.AzureMonitorPrivateLinkScopeListResult"]: + ) -> AsyncIterable["_models.AzureMonitorPrivateLinkScopeListResult"]: """Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -54,7 +54,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScopeListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScopeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -71,7 +71,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -113,7 +113,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.AzureMonitorPrivateLinkScopeListResult"]: + ) -> AsyncIterable["_models.AzureMonitorPrivateLinkScopeListResult"]: """Gets a list of Azure Monitor PrivateLinkScopes within a resource group. :param resource_group_name: The name of the resource group. @@ -123,7 +123,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScopeListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScopeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -141,7 +141,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -196,7 +196,7 @@ async def _delete_initial( url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -265,7 +265,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -284,7 +290,7 @@ async def get( resource_group_name: str, scope_name: str, **kwargs - ) -> "models.AzureMonitorPrivateLinkScope": + ) -> "_models.AzureMonitorPrivateLinkScope": """Returns a Azure Monitor PrivateLinkScope. :param resource_group_name: The name of the resource group. @@ -296,7 +302,7 @@ async def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScope :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScope"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScope"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -308,7 +314,7 @@ async def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -341,9 +347,9 @@ async def create_or_update( self, resource_group_name: str, scope_name: str, - azure_monitor_private_link_scope_payload: "models.AzureMonitorPrivateLinkScope", + azure_monitor_private_link_scope_payload: "_models.AzureMonitorPrivateLinkScope", **kwargs - ) -> "models.AzureMonitorPrivateLinkScope": + ) -> "_models.AzureMonitorPrivateLinkScope": """Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. @@ -359,7 +365,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScope :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScope"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScope"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -372,7 +378,7 @@ async def create_or_update( url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -413,9 +419,9 @@ async def update_tags( self, resource_group_name: str, scope_name: str, - private_link_scope_tags: "models.TagsResource", + private_link_scope_tags: "_models.TagsResource", **kwargs - ) -> "models.AzureMonitorPrivateLinkScope": + ) -> "_models.AzureMonitorPrivateLinkScope": """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. @@ -431,7 +437,7 @@ async def update_tags( :rtype: ~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScope :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScope"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScope"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -444,7 +450,7 @@ async def update_tags( url = self.update_tags.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_endpoint_connections_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_endpoint_connections_operations.py index 795d9364097f0..f7f91017e9f7e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_endpoint_connections_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_endpoint_connections_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -54,7 +54,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> "_models.PrivateEndpointConnection" """Gets a private endpoint connection. :param resource_group_name: The name of the resource group. @@ -68,7 +68,7 @@ def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -79,7 +79,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -115,11 +115,11 @@ def _create_or_update_initial( resource_group_name, # type: str scope_name, # type: str private_endpoint_connection_name, # type: str - parameters, # type: "models.PrivateEndpointConnection" + parameters, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -131,7 +131,7 @@ def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -173,10 +173,10 @@ def begin_create_or_update( resource_group_name, # type: str scope_name, # type: str private_endpoint_connection_name, # type: str - parameters, # type: "models.PrivateEndpointConnection" + parameters, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] """Approve or reject a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. @@ -198,7 +198,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -224,7 +224,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -256,7 +263,7 @@ def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -332,7 +339,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -352,7 +366,7 @@ def list_by_private_link_scope( scope_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PrivateEndpointConnectionListResult"] + # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] """Gets all private endpoint connections on a private link scope. :param resource_group_name: The name of the resource group. @@ -364,7 +378,7 @@ def list_by_private_link_scope( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -381,7 +395,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_resources_operations.py index 25bd633a17fd2..669f69362ef80 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_resources_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list_by_private_link_scope( scope_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PrivateLinkResourceListResult"] + # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. :param resource_group_name: The name of the resource group. @@ -63,7 +63,7 @@ def list_by_private_link_scope( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -80,7 +80,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } @@ -127,7 +127,7 @@ def get( group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResource" + # type: (...) -> "_models.PrivateLinkResource" """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. :param resource_group_name: The name of the resource group. @@ -141,7 +141,7 @@ def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -152,7 +152,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'groupName': self._serialize.url("group_name", group_name, 'str'), diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scope_operation_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scope_operation_status_operations.py index 3f289ceffea14..e2af92cf65293 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scope_operation_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scope_operation_status_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkScopeOperationStatusOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.OperationStatus" + # type: (...) -> "_models.OperationStatus" """Get the status of an azure asynchronous operation associated with a private link scope operation. @@ -63,7 +63,7 @@ def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.OperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -76,7 +76,7 @@ def get( path_format_arguments = { 'asyncOperationId': self._serialize.url("async_operation_id", async_operation_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scoped_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scoped_resources_operations.py index 6c192514ac5aa..45b7372e65b1d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scoped_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scoped_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class PrivateLinkScopedResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -54,7 +54,7 @@ def get( name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ScopedResource" + # type: (...) -> "_models.ScopedResource" """Gets a scoped resource in a private link scope. :param resource_group_name: The name of the resource group. @@ -68,7 +68,7 @@ def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.ScopedResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScopedResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -79,7 +79,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -115,11 +115,11 @@ def _create_or_update_initial( resource_group_name, # type: str scope_name, # type: str name, # type: str - parameters, # type: "models.ScopedResource" + parameters, # type: "_models.ScopedResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.ScopedResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ScopedResource"]] + # type: (...) -> Optional["_models.ScopedResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ScopedResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -131,7 +131,7 @@ def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -176,10 +176,10 @@ def begin_create_or_update( resource_group_name, # type: str scope_name, # type: str name, # type: str - parameters, # type: "models.ScopedResource" + parameters, # type: "_models.ScopedResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ScopedResource"] + # type: (...) -> LROPoller["_models.ScopedResource"] """Approve or reject a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. @@ -201,7 +201,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ScopedResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -227,7 +227,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,7 +266,7 @@ def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -335,7 +342,14 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -355,7 +369,7 @@ def list_by_private_link_scope( scope_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ScopedResourceListResult"] + # type: (...) -> Iterable["_models.ScopedResourceListResult"] """Gets all private endpoint connections on a private link scope. :param resource_group_name: The name of the resource group. @@ -367,7 +381,7 @@ def list_by_private_link_scope( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.ScopedResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScopedResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -384,7 +398,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scopes_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scopes_operations.py index 8e10edb8e9ed0..01f3919b9eb9e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scopes_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scopes_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class PrivateLinkScopesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.AzureMonitorPrivateLinkScopeListResult"] + # type: (...) -> Iterable["_models.AzureMonitorPrivateLinkScopeListResult"] """Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -59,7 +59,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScopeListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScopeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -76,7 +76,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -119,7 +119,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.AzureMonitorPrivateLinkScopeListResult"] + # type: (...) -> Iterable["_models.AzureMonitorPrivateLinkScopeListResult"] """Gets a list of Azure Monitor PrivateLinkScopes within a resource group. :param resource_group_name: The name of the resource group. @@ -129,7 +129,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScopeListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScopeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -147,7 +147,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -203,7 +203,7 @@ def _delete_initial( url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -273,7 +273,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -293,7 +299,7 @@ def get( scope_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.AzureMonitorPrivateLinkScope" + # type: (...) -> "_models.AzureMonitorPrivateLinkScope" """Returns a Azure Monitor PrivateLinkScope. :param resource_group_name: The name of the resource group. @@ -305,7 +311,7 @@ def get( :rtype: ~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScope :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScope"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScope"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -317,7 +323,7 @@ def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -350,10 +356,10 @@ def create_or_update( self, resource_group_name, # type: str scope_name, # type: str - azure_monitor_private_link_scope_payload, # type: "models.AzureMonitorPrivateLinkScope" + azure_monitor_private_link_scope_payload, # type: "_models.AzureMonitorPrivateLinkScope" **kwargs # type: Any ): - # type: (...) -> "models.AzureMonitorPrivateLinkScope" + # type: (...) -> "_models.AzureMonitorPrivateLinkScope" """Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. @@ -369,7 +375,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScope :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScope"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScope"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -382,7 +388,7 @@ def create_or_update( url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -423,10 +429,10 @@ def update_tags( self, resource_group_name, # type: str scope_name, # type: str - private_link_scope_tags, # type: "models.TagsResource" + private_link_scope_tags, # type: "_models.TagsResource" **kwargs # type: Any ): - # type: (...) -> "models.AzureMonitorPrivateLinkScope" + # type: (...) -> "_models.AzureMonitorPrivateLinkScope" """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. @@ -442,7 +448,7 @@ def update_tags( :rtype: ~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScope :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AzureMonitorPrivateLinkScope"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScope"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -455,7 +461,7 @@ def update_tags( url = self.update_tags.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/__init__.py new file mode 100644 index 0000000000000..fa63968b37592 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py new file mode 100644 index 0000000000000..7a00eb694f1eb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json new file mode 100644 index 0000000000000..c0b06cb89a145 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json @@ -0,0 +1,62 @@ +{ + "chosen_version": "2019-11-01-preview", + "total_api_version_list": ["2019-11-01-preview"], + "client": { + "name": "MonitorClient", + "filename": "_monitor_client", + "description": "Monitor Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": true + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "data_collection_rule_associations": "DataCollectionRuleAssociationsOperations", + "data_collection_rules": "DataCollectionRulesOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_client.py new file mode 100644 index 0000000000000..528421a8cb96b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_client.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import MonitorClientConfiguration +from .operations import DataCollectionRuleAssociationsOperations +from .operations import DataCollectionRulesOperations +from . import models + + +class MonitorClient(object): + """Monitor Management Client. + + :ivar data_collection_rule_associations: DataCollectionRuleAssociationsOperations operations + :vartype data_collection_rule_associations: $(python-base-namespace).v2019_11_01_preview.operations.DataCollectionRuleAssociationsOperations + :ivar data_collection_rules: DataCollectionRulesOperations operations + :vartype data_collection_rules: $(python-base-namespace).v2019_11_01_preview.operations.DataCollectionRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.data_collection_rule_associations = DataCollectionRuleAssociationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_collection_rules = DataCollectionRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> MonitorClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/__init__.py new file mode 100644 index 0000000000000..7096a59fbc1f0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py new file mode 100644 index 0000000000000..d84f7c4bcb3d0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_client.py new file mode 100644 index 0000000000000..b435d889ab516 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_client.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import MonitorClientConfiguration +from .operations import DataCollectionRuleAssociationsOperations +from .operations import DataCollectionRulesOperations +from .. import models + + +class MonitorClient(object): + """Monitor Management Client. + + :ivar data_collection_rule_associations: DataCollectionRuleAssociationsOperations operations + :vartype data_collection_rule_associations: $(python-base-namespace).v2019_11_01_preview.aio.operations.DataCollectionRuleAssociationsOperations + :ivar data_collection_rules: DataCollectionRulesOperations operations + :vartype data_collection_rules: $(python-base-namespace).v2019_11_01_preview.aio.operations.DataCollectionRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.data_collection_rule_associations = DataCollectionRuleAssociationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_collection_rules = DataCollectionRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MonitorClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/__init__.py new file mode 100644 index 0000000000000..f755a04ab0654 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_collection_rule_associations_operations import DataCollectionRuleAssociationsOperations +from ._data_collection_rules_operations import DataCollectionRulesOperations + +__all__ = [ + 'DataCollectionRuleAssociationsOperations', + 'DataCollectionRulesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py new file mode 100644 index 0000000000000..b1cf0eab42bdc --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py @@ -0,0 +1,384 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionRuleAssociationsOperations: + """DataCollectionRuleAssociationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2019_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource( + self, + resource_uri: str, + **kwargs + ) -> AsyncIterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"]: + """Lists associations for the specified resource. + + Lists associations for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + + def list_by_rule( + self, + resource_group_name: str, + data_collection_rule_name: str, + **kwargs + ) -> AsyncIterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"]: + """Lists associations for the specified data collection rule. + + Lists associations for the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + + async def get( + self, + resource_uri: str, + association_name: str, + **kwargs + ) -> "_models.DataCollectionRuleAssociationProxyOnlyResource": + """Returns the specified association. + + Returns the specified association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + + async def create( + self, + resource_uri: str, + association_name: str, + body: Optional["_models.DataCollectionRuleAssociationProxyOnlyResource"] = None, + **kwargs + ) -> "_models.DataCollectionRuleAssociationProxyOnlyResource": + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. + :type association_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionRuleAssociationProxyOnlyResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + + async def delete( + self, + resource_uri: str, + association_name: str, + **kwargs + ) -> None: + """Deletes an association. + + Deletes an association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py new file mode 100644 index 0000000000000..eaa21916a40e9 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py @@ -0,0 +1,455 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionRulesOperations: + """DataCollectionRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2019_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.DataCollectionRuleResourceListResult"]: + """Lists all data collection rules in the specified resource group. + + Lists all data collection rules in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.DataCollectionRuleResourceListResult"]: + """Lists all data collection rules in the specified subscription. + + Lists all data collection rules in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + + async def get( + self, + resource_group_name: str, + data_collection_rule_name: str, + **kwargs + ) -> "_models.DataCollectionRuleResource": + """Returns the specified data collection rule. + + Returns the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + async def create( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional["_models.DataCollectionRuleResource"] = None, + **kwargs + ) -> "_models.DataCollectionRuleResource": + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionRuleResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional["_models.ResourceForUpdate"] = None, + **kwargs + ) -> "_models.DataCollectionRuleResource": + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2019_11_01_preview.models.ResourceForUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'ResourceForUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + data_collection_rule_name: str, + **kwargs + ) -> None: + """Deletes a data collection rule. + + Deletes a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/__init__.py new file mode 100644 index 0000000000000..161faf6d805f1 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/__init__.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AzureMonitorMetricsDestination + from ._models_py3 import DataCollectionRule + from ._models_py3 import DataCollectionRuleAssociation + from ._models_py3 import DataCollectionRuleAssociationProxyOnlyResource + from ._models_py3 import DataCollectionRuleAssociationProxyOnlyResourceListResult + from ._models_py3 import DataCollectionRuleAssociationProxyOnlyResourceProperties + from ._models_py3 import DataCollectionRuleDataSources + from ._models_py3 import DataCollectionRuleDestinations + from ._models_py3 import DataCollectionRuleResource + from ._models_py3 import DataCollectionRuleResourceListResult + from ._models_py3 import DataCollectionRuleResourceProperties + from ._models_py3 import DataFlow + from ._models_py3 import DataSourcesSpec + from ._models_py3 import DestinationsSpec + from ._models_py3 import DestinationsSpecAzureMonitorMetrics + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetails + from ._models_py3 import ErrorDetailsAutoGenerated + from ._models_py3 import ErrorResponse + from ._models_py3 import ErrorResponseAutoGenerated + from ._models_py3 import ErrorResponseError + from ._models_py3 import ErrorResponseErrorAutoGenerated + from ._models_py3 import ExtensionDataSource + from ._models_py3 import LogAnalyticsDestination + from ._models_py3 import PerfCounterDataSource + from ._models_py3 import ResourceForUpdate + from ._models_py3 import SyslogDataSource + from ._models_py3 import WindowsEventLogDataSource +except (SyntaxError, ImportError): + from ._models import AzureMonitorMetricsDestination # type: ignore + from ._models import DataCollectionRule # type: ignore + from ._models import DataCollectionRuleAssociation # type: ignore + from ._models import DataCollectionRuleAssociationProxyOnlyResource # type: ignore + from ._models import DataCollectionRuleAssociationProxyOnlyResourceListResult # type: ignore + from ._models import DataCollectionRuleAssociationProxyOnlyResourceProperties # type: ignore + from ._models import DataCollectionRuleDataSources # type: ignore + from ._models import DataCollectionRuleDestinations # type: ignore + from ._models import DataCollectionRuleResource # type: ignore + from ._models import DataCollectionRuleResourceListResult # type: ignore + from ._models import DataCollectionRuleResourceProperties # type: ignore + from ._models import DataFlow # type: ignore + from ._models import DataSourcesSpec # type: ignore + from ._models import DestinationsSpec # type: ignore + from ._models import DestinationsSpecAzureMonitorMetrics # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import ErrorDetailsAutoGenerated # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ErrorResponseAutoGenerated # type: ignore + from ._models import ErrorResponseError # type: ignore + from ._models import ErrorResponseErrorAutoGenerated # type: ignore + from ._models import ExtensionDataSource # type: ignore + from ._models import LogAnalyticsDestination # type: ignore + from ._models import PerfCounterDataSource # type: ignore + from ._models import ResourceForUpdate # type: ignore + from ._models import SyslogDataSource # type: ignore + from ._models import WindowsEventLogDataSource # type: ignore + +from ._monitor_client_enums import ( + KnownDataCollectionRuleAssociationProvisioningState, + KnownDataCollectionRuleProvisioningState, + KnownDataFlowStreams, + KnownExtensionDataSourceStreams, + KnownPerfCounterDataSourceScheduledTransferPeriod, + KnownPerfCounterDataSourceStreams, + KnownSyslogDataSourceFacilityNames, + KnownSyslogDataSourceLogLevels, + KnownSyslogDataSourceStreams, + KnownWindowsEventLogDataSourceScheduledTransferPeriod, + KnownWindowsEventLogDataSourceStreams, +) + +__all__ = [ + 'AzureMonitorMetricsDestination', + 'DataCollectionRule', + 'DataCollectionRuleAssociation', + 'DataCollectionRuleAssociationProxyOnlyResource', + 'DataCollectionRuleAssociationProxyOnlyResourceListResult', + 'DataCollectionRuleAssociationProxyOnlyResourceProperties', + 'DataCollectionRuleDataSources', + 'DataCollectionRuleDestinations', + 'DataCollectionRuleResource', + 'DataCollectionRuleResourceListResult', + 'DataCollectionRuleResourceProperties', + 'DataFlow', + 'DataSourcesSpec', + 'DestinationsSpec', + 'DestinationsSpecAzureMonitorMetrics', + 'ErrorAdditionalInfo', + 'ErrorDetails', + 'ErrorDetailsAutoGenerated', + 'ErrorResponse', + 'ErrorResponseAutoGenerated', + 'ErrorResponseError', + 'ErrorResponseErrorAutoGenerated', + 'ExtensionDataSource', + 'LogAnalyticsDestination', + 'PerfCounterDataSource', + 'ResourceForUpdate', + 'SyslogDataSource', + 'WindowsEventLogDataSource', + 'KnownDataCollectionRuleAssociationProvisioningState', + 'KnownDataCollectionRuleProvisioningState', + 'KnownDataFlowStreams', + 'KnownExtensionDataSourceStreams', + 'KnownPerfCounterDataSourceScheduledTransferPeriod', + 'KnownPerfCounterDataSourceStreams', + 'KnownSyslogDataSourceFacilityNames', + 'KnownSyslogDataSourceLogLevels', + 'KnownSyslogDataSourceStreams', + 'KnownWindowsEventLogDataSourceScheduledTransferPeriod', + 'KnownWindowsEventLogDataSourceStreams', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models.py new file mode 100644 index 0000000000000..60075942c9d58 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models.py @@ -0,0 +1,1089 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AzureMonitorMetricsDestination(msrest.serialization.Model): + """Azure Monitor Metrics destination. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureMonitorMetricsDestination, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class DataCollectionRule(msrest.serialization.Model): + """Definition of what monitoring data to collect and where that data should be sent. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the data collection rule. + :type description: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec + :param destinations: Required. The specification of destinations. + :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec + :param data_flows: Required. The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'description': {'max_length': 256, 'min_length': 0}, + 'destinations': {'required': True}, + 'data_flows': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSourcesSpec'}, + 'destinations': {'key': 'destinations', 'type': 'DestinationsSpec'}, + 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRule, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.data_sources = kwargs.get('data_sources', None) + self.destinations = kwargs['destinations'] + self.data_flows = kwargs['data_flows'] + self.provisioning_state = None + + +class DataCollectionRuleAssociation(msrest.serialization.Model): + """Definition of association of a data collection rule with a monitored Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: Required. The resource ID of the data collection rule that is + to be associated. + :type data_collection_rule_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'description': {'max_length': 256, 'min_length': 0}, + 'data_collection_rule_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'dataCollectionRuleId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleAssociation, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.data_collection_rule_id = kwargs['data_collection_rule_id'] + self.provisioning_state = None + + +class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model): + """Definition of generic ARM proxy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: Required. The resource ID of the data collection rule that is + to be associated. + :type data_collection_rule_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'description': {'max_length': 256, 'min_length': 0}, + 'data_collection_rule_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'properties.dataCollectionRuleId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = None + self.description = kwargs.get('description', None) + self.data_collection_rule_id = kwargs['data_collection_rule_id'] + self.provisioning_state = None + + +class DataCollectionRuleAssociationProxyOnlyResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: list[~$(python-base- + namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionRuleAssociationProxyOnlyResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class DataCollectionRuleAssociationProxyOnlyResourceProperties(DataCollectionRuleAssociation): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: Required. The resource ID of the data collection rule that is + to be associated. + :type data_collection_rule_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'description': {'max_length': 256, 'min_length': 0}, + 'data_collection_rule_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'dataCollectionRuleId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceProperties, self).__init__(**kwargs) + + +class DataSourcesSpec(msrest.serialization.Model): + """Specification of data sources that will be collected. + + :param performance_counters: The list of performance counter data source configurations. + :type performance_counters: list[~$(python-base- + namespace).v2019_11_01_preview.models.PerfCounterDataSource] + :param windows_event_logs: The list of Windows Event Log data source configurations. + :type windows_event_logs: list[~$(python-base- + namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] + :param syslog: The list of Syslog data source configurations. + :type syslog: list[~$(python-base-namespace).v2019_11_01_preview.models.SyslogDataSource] + :param extensions: The list of Azure VM extension data source configurations. + :type extensions: list[~$(python-base- + namespace).v2019_11_01_preview.models.ExtensionDataSource] + """ + + _attribute_map = { + 'performance_counters': {'key': 'performanceCounters', 'type': '[PerfCounterDataSource]'}, + 'windows_event_logs': {'key': 'windowsEventLogs', 'type': '[WindowsEventLogDataSource]'}, + 'syslog': {'key': 'syslog', 'type': '[SyslogDataSource]'}, + 'extensions': {'key': 'extensions', 'type': '[ExtensionDataSource]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataSourcesSpec, self).__init__(**kwargs) + self.performance_counters = kwargs.get('performance_counters', None) + self.windows_event_logs = kwargs.get('windows_event_logs', None) + self.syslog = kwargs.get('syslog', None) + self.extensions = kwargs.get('extensions', None) + + +class DataCollectionRuleDataSources(DataSourcesSpec): + """The specification of data sources. +This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. + + :param performance_counters: The list of performance counter data source configurations. + :type performance_counters: list[~$(python-base- + namespace).v2019_11_01_preview.models.PerfCounterDataSource] + :param windows_event_logs: The list of Windows Event Log data source configurations. + :type windows_event_logs: list[~$(python-base- + namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] + :param syslog: The list of Syslog data source configurations. + :type syslog: list[~$(python-base-namespace).v2019_11_01_preview.models.SyslogDataSource] + :param extensions: The list of Azure VM extension data source configurations. + :type extensions: list[~$(python-base- + namespace).v2019_11_01_preview.models.ExtensionDataSource] + """ + + _attribute_map = { + 'performance_counters': {'key': 'performanceCounters', 'type': '[PerfCounterDataSource]'}, + 'windows_event_logs': {'key': 'windowsEventLogs', 'type': '[WindowsEventLogDataSource]'}, + 'syslog': {'key': 'syslog', 'type': '[SyslogDataSource]'}, + 'extensions': {'key': 'extensions', 'type': '[ExtensionDataSource]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleDataSources, self).__init__(**kwargs) + + +class DestinationsSpec(msrest.serialization.Model): + """Specification of destinations that can be used in data flows. + + :param log_analytics: List of Log Analytics destinations. + :type log_analytics: list[~$(python-base- + namespace).v2019_11_01_preview.models.LogAnalyticsDestination] + :param azure_monitor_metrics: Azure Monitor Metrics destination. + :type azure_monitor_metrics: ~$(python-base- + namespace).v2019_11_01_preview.models.AzureMonitorMetricsDestination + """ + + _attribute_map = { + 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'AzureMonitorMetricsDestination'}, + } + + def __init__( + self, + **kwargs + ): + super(DestinationsSpec, self).__init__(**kwargs) + self.log_analytics = kwargs.get('log_analytics', None) + self.azure_monitor_metrics = kwargs.get('azure_monitor_metrics', None) + + +class DataCollectionRuleDestinations(DestinationsSpec): + """The specification of destinations. + + :param log_analytics: List of Log Analytics destinations. + :type log_analytics: list[~$(python-base- + namespace).v2019_11_01_preview.models.LogAnalyticsDestination] + :param azure_monitor_metrics: Azure Monitor Metrics destination. + :type azure_monitor_metrics: ~$(python-base- + namespace).v2019_11_01_preview.models.AzureMonitorMetricsDestination + """ + + _attribute_map = { + 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'AzureMonitorMetricsDestination'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleDestinations, self).__init__(**kwargs) + + +class DataCollectionRuleResource(msrest.serialization.Model): + """Definition of ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :param description: Description of the data collection rule. + :type description: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec + :param destinations: Required. The specification of destinations. + :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec + :param data_flows: Required. The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'location': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'description': {'max_length': 256, 'min_length': 0}, + 'destinations': {'required': True}, + 'data_flows': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': 'DataSourcesSpec'}, + 'destinations': {'key': 'properties.destinations', 'type': 'DestinationsSpec'}, + 'data_flows': {'key': 'properties.dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleResource, self).__init__(**kwargs) + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.id = None + self.name = None + self.type = None + self.etag = None + self.description = kwargs.get('description', None) + self.data_sources = kwargs.get('data_sources', None) + self.destinations = kwargs['destinations'] + self.data_flows = kwargs['data_flows'] + self.provisioning_state = None + + +class DataCollectionRuleResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: list[~$(python-base- + namespace).v2019_11_01_preview.models.DataCollectionRuleResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleResourceListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class DataCollectionRuleResourceProperties(DataCollectionRule): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the data collection rule. + :type description: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec + :param destinations: Required. The specification of destinations. + :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec + :param data_flows: Required. The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'description': {'max_length': 256, 'min_length': 0}, + 'destinations': {'required': True}, + 'data_flows': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSourcesSpec'}, + 'destinations': {'key': 'destinations', 'type': 'DestinationsSpec'}, + 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleResourceProperties, self).__init__(**kwargs) + + +class DataFlow(msrest.serialization.Model): + """Definition of which streams are sent to which destinations. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams for this data flow. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataFlowStreams] + :param destinations: Required. List of destinations for this data flow. + :type destinations: list[str] + """ + + _validation = { + 'streams': {'required': True}, + 'destinations': {'required': True}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'destinations': {'key': 'destinations', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataFlow, self).__init__(**kwargs) + self.streams = kwargs['streams'] + self.destinations = kwargs['destinations'] + + +class DestinationsSpecAzureMonitorMetrics(AzureMonitorMetricsDestination): + """Azure Monitor Metrics destination. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DestinationsSpecAzureMonitorMetrics, self).__init__(**kwargs) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """Additional information for common error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetails(msrest.serialization.Model): + """Common error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code which can be used to programmatically identify the class of error. + :vartype code: str + :ivar message: Describes the error in detail and provides debugging information. + :vartype message: str + :ivar target: The target of the particular error (for example, the name of the property in + error). + :vartype target: str + :ivar details: Additional nested error detail objects. + :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] + :ivar additional_info: Additional error information. + :vartype additional_info: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorDetailsAutoGenerated(msrest.serialization.Model): + """Common error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code which can be used to programmatically identify the class of error. + :vartype code: str + :ivar message: Describes the error in detail and provides debugging information. + :vartype message: str + :ivar target: The target of the particular error (for example, the name of the property in + error). + :vartype target: str + :ivar details: Additional nested error detail objects. + :vartype details: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] + :ivar additional_info: Additional error information. + :vartype additional_info: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetailsAutoGenerated, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Error details. + :vartype error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = None + + +class ErrorResponseAutoGenerated(msrest.serialization.Model): + """Common error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Error details. + :vartype error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetailsAutoGenerated'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseAutoGenerated, self).__init__(**kwargs) + self.error = None + + +class ErrorResponseError(ErrorDetails): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code which can be used to programmatically identify the class of error. + :vartype code: str + :ivar message: Describes the error in detail and provides debugging information. + :vartype message: str + :ivar target: The target of the particular error (for example, the name of the property in + error). + :vartype target: str + :ivar details: Additional nested error detail objects. + :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] + :ivar additional_info: Additional error information. + :vartype additional_info: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + + +class ErrorResponseErrorAutoGenerated(ErrorDetailsAutoGenerated): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code which can be used to programmatically identify the class of error. + :vartype code: str + :ivar message: Describes the error in detail and provides debugging information. + :vartype message: str + :ivar target: The target of the particular error (for example, the name of the property in + error). + :vartype target: str + :ivar details: Additional nested error detail objects. + :vartype details: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] + :ivar additional_info: Additional error information. + :vartype additional_info: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseErrorAutoGenerated, self).__init__(**kwargs) + + +class ExtensionDataSource(msrest.serialization.Model): + """Definition of which data will be collected from a separate VM extension that integrates with the Azure Monitor Agent. +Collected from either Windows and Linux machines, depending on which extension is defined. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownExtensionDataSourceStreams] + :param extension_name: Required. The name of the VM extension. + :type extension_name: str + :param extension_settings: The extension settings. The format is specific for particular + extension. + :type extension_settings: object + :param name: Required. A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'streams': {'required': True}, + 'extension_name': {'required': True, 'max_length': 64, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'extension_name': {'key': 'extensionName', 'type': 'str'}, + 'extension_settings': {'key': 'extensionSettings', 'type': 'object'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExtensionDataSource, self).__init__(**kwargs) + self.streams = kwargs['streams'] + self.extension_name = kwargs['extension_name'] + self.extension_settings = kwargs.get('extension_settings', None) + self.name = kwargs['name'] + + +class LogAnalyticsDestination(msrest.serialization.Model): + """Log Analytics destination. + + All required parameters must be populated in order to send to Azure. + + :param workspace_resource_id: Required. The resource ID of the Log Analytics workspace. + :type workspace_resource_id: str + :param name: Required. A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'workspace_resource_id': {'required': True}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogAnalyticsDestination, self).__init__(**kwargs) + self.workspace_resource_id = kwargs['workspace_resource_id'] + self.name = kwargs['name'] + + +class PerfCounterDataSource(msrest.serialization.Model): + """Definition of which performance counters will be collected and how they will be collected by this data collection rule. +Collected from both Windows and Linux machines where the counter is present. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceStreams] + :param scheduled_transfer_period: Required. The interval between data uploads (scheduled + transfers), rounded up to the nearest minute. Possible values include: "PT1M", "PT5M", "PT15M", + "PT30M", "PT60M". + :type scheduled_transfer_period: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceScheduledTransferPeriod + :param sampling_frequency_in_seconds: Required. The number of seconds between consecutive + counter measurements (samples). + :type sampling_frequency_in_seconds: int + :param counter_specifiers: Required. A list of specifier names of the performance counters you + want to collect. + Use a wildcard (*) to collect a counter for all instances. + To get a list of performance counters on Windows, run the command 'typeperf'. + :type counter_specifiers: list[str] + :param name: Required. A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'streams': {'required': True}, + 'scheduled_transfer_period': {'required': True}, + 'sampling_frequency_in_seconds': {'required': True, 'maximum': 30, 'minimum': 1}, + 'counter_specifiers': {'required': True}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'scheduled_transfer_period': {'key': 'scheduledTransferPeriod', 'type': 'str'}, + 'sampling_frequency_in_seconds': {'key': 'samplingFrequencyInSeconds', 'type': 'int'}, + 'counter_specifiers': {'key': 'counterSpecifiers', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PerfCounterDataSource, self).__init__(**kwargs) + self.streams = kwargs['streams'] + self.scheduled_transfer_period = kwargs['scheduled_transfer_period'] + self.sampling_frequency_in_seconds = kwargs['sampling_frequency_in_seconds'] + self.counter_specifiers = kwargs['counter_specifiers'] + self.name = kwargs['name'] + + +class ResourceForUpdate(msrest.serialization.Model): + """Definition of ARM tracked top level resource properties for update operation. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceForUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class SyslogDataSource(msrest.serialization.Model): + """Definition of which syslog data will be collected and how it will be collected. +Only collected from Linux machines. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownSyslogDataSourceStreams] + :param facility_names: Required. The list of facility names. + :type facility_names: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownSyslogDataSourceFacilityNames] + :param log_levels: The log levels to collect. + :type log_levels: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownSyslogDataSourceLogLevels] + :param name: Required. A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'streams': {'required': True}, + 'facility_names': {'required': True}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'facility_names': {'key': 'facilityNames', 'type': '[str]'}, + 'log_levels': {'key': 'logLevels', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SyslogDataSource, self).__init__(**kwargs) + self.streams = kwargs['streams'] + self.facility_names = kwargs['facility_names'] + self.log_levels = kwargs.get('log_levels', None) + self.name = kwargs['name'] + + +class WindowsEventLogDataSource(msrest.serialization.Model): + """Definition of which Windows Event Log events will be collected and how they will be collected. +Only collected from Windows machines. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceStreams] + :param scheduled_transfer_period: Required. The interval between data uploads (scheduled + transfers), rounded up to the nearest minute. Possible values include: "PT1M", "PT5M", "PT15M", + "PT30M", "PT60M". + :type scheduled_transfer_period: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceScheduledTransferPeriod + :param x_path_queries: Required. A list of Windows Event Log queries in XPATH format. + :type x_path_queries: list[str] + :param name: Required. A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'streams': {'required': True}, + 'scheduled_transfer_period': {'required': True}, + 'x_path_queries': {'required': True}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'scheduled_transfer_period': {'key': 'scheduledTransferPeriod', 'type': 'str'}, + 'x_path_queries': {'key': 'xPathQueries', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WindowsEventLogDataSource, self).__init__(**kwargs) + self.streams = kwargs['streams'] + self.scheduled_transfer_period = kwargs['scheduled_transfer_period'] + self.x_path_queries = kwargs['x_path_queries'] + self.name = kwargs['name'] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..2a19661dae905 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models_py3.py @@ -0,0 +1,1174 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._monitor_client_enums import * + + +class AzureMonitorMetricsDestination(msrest.serialization.Model): + """Azure Monitor Metrics destination. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(AzureMonitorMetricsDestination, self).__init__(**kwargs) + self.name = name + + +class DataCollectionRule(msrest.serialization.Model): + """Definition of what monitoring data to collect and where that data should be sent. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the data collection rule. + :type description: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec + :param destinations: Required. The specification of destinations. + :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec + :param data_flows: Required. The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'description': {'max_length': 256, 'min_length': 0}, + 'destinations': {'required': True}, + 'data_flows': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSourcesSpec'}, + 'destinations': {'key': 'destinations', 'type': 'DestinationsSpec'}, + 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + destinations: "DestinationsSpec", + data_flows: List["DataFlow"], + description: Optional[str] = None, + data_sources: Optional["DataSourcesSpec"] = None, + **kwargs + ): + super(DataCollectionRule, self).__init__(**kwargs) + self.description = description + self.data_sources = data_sources + self.destinations = destinations + self.data_flows = data_flows + self.provisioning_state = None + + +class DataCollectionRuleAssociation(msrest.serialization.Model): + """Definition of association of a data collection rule with a monitored Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: Required. The resource ID of the data collection rule that is + to be associated. + :type data_collection_rule_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'description': {'max_length': 256, 'min_length': 0}, + 'data_collection_rule_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'dataCollectionRuleId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + data_collection_rule_id: str, + description: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleAssociation, self).__init__(**kwargs) + self.description = description + self.data_collection_rule_id = data_collection_rule_id + self.provisioning_state = None + + +class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model): + """Definition of generic ARM proxy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: Required. The resource ID of the data collection rule that is + to be associated. + :type data_collection_rule_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'description': {'max_length': 256, 'min_length': 0}, + 'data_collection_rule_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'properties.dataCollectionRuleId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + data_collection_rule_id: str, + description: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = None + self.description = description + self.data_collection_rule_id = data_collection_rule_id + self.provisioning_state = None + + +class DataCollectionRuleAssociationProxyOnlyResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: list[~$(python-base- + namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionRuleAssociationProxyOnlyResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DataCollectionRuleAssociationProxyOnlyResource"], + next_link: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DataCollectionRuleAssociationProxyOnlyResourceProperties(DataCollectionRuleAssociation): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: Required. The resource ID of the data collection rule that is + to be associated. + :type data_collection_rule_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'description': {'max_length': 256, 'min_length': 0}, + 'data_collection_rule_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'dataCollectionRuleId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + data_collection_rule_id: str, + description: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceProperties, self).__init__(description=description, data_collection_rule_id=data_collection_rule_id, **kwargs) + + +class DataSourcesSpec(msrest.serialization.Model): + """Specification of data sources that will be collected. + + :param performance_counters: The list of performance counter data source configurations. + :type performance_counters: list[~$(python-base- + namespace).v2019_11_01_preview.models.PerfCounterDataSource] + :param windows_event_logs: The list of Windows Event Log data source configurations. + :type windows_event_logs: list[~$(python-base- + namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] + :param syslog: The list of Syslog data source configurations. + :type syslog: list[~$(python-base-namespace).v2019_11_01_preview.models.SyslogDataSource] + :param extensions: The list of Azure VM extension data source configurations. + :type extensions: list[~$(python-base- + namespace).v2019_11_01_preview.models.ExtensionDataSource] + """ + + _attribute_map = { + 'performance_counters': {'key': 'performanceCounters', 'type': '[PerfCounterDataSource]'}, + 'windows_event_logs': {'key': 'windowsEventLogs', 'type': '[WindowsEventLogDataSource]'}, + 'syslog': {'key': 'syslog', 'type': '[SyslogDataSource]'}, + 'extensions': {'key': 'extensions', 'type': '[ExtensionDataSource]'}, + } + + def __init__( + self, + *, + performance_counters: Optional[List["PerfCounterDataSource"]] = None, + windows_event_logs: Optional[List["WindowsEventLogDataSource"]] = None, + syslog: Optional[List["SyslogDataSource"]] = None, + extensions: Optional[List["ExtensionDataSource"]] = None, + **kwargs + ): + super(DataSourcesSpec, self).__init__(**kwargs) + self.performance_counters = performance_counters + self.windows_event_logs = windows_event_logs + self.syslog = syslog + self.extensions = extensions + + +class DataCollectionRuleDataSources(DataSourcesSpec): + """The specification of data sources. +This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. + + :param performance_counters: The list of performance counter data source configurations. + :type performance_counters: list[~$(python-base- + namespace).v2019_11_01_preview.models.PerfCounterDataSource] + :param windows_event_logs: The list of Windows Event Log data source configurations. + :type windows_event_logs: list[~$(python-base- + namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] + :param syslog: The list of Syslog data source configurations. + :type syslog: list[~$(python-base-namespace).v2019_11_01_preview.models.SyslogDataSource] + :param extensions: The list of Azure VM extension data source configurations. + :type extensions: list[~$(python-base- + namespace).v2019_11_01_preview.models.ExtensionDataSource] + """ + + _attribute_map = { + 'performance_counters': {'key': 'performanceCounters', 'type': '[PerfCounterDataSource]'}, + 'windows_event_logs': {'key': 'windowsEventLogs', 'type': '[WindowsEventLogDataSource]'}, + 'syslog': {'key': 'syslog', 'type': '[SyslogDataSource]'}, + 'extensions': {'key': 'extensions', 'type': '[ExtensionDataSource]'}, + } + + def __init__( + self, + *, + performance_counters: Optional[List["PerfCounterDataSource"]] = None, + windows_event_logs: Optional[List["WindowsEventLogDataSource"]] = None, + syslog: Optional[List["SyslogDataSource"]] = None, + extensions: Optional[List["ExtensionDataSource"]] = None, + **kwargs + ): + super(DataCollectionRuleDataSources, self).__init__(performance_counters=performance_counters, windows_event_logs=windows_event_logs, syslog=syslog, extensions=extensions, **kwargs) + + +class DestinationsSpec(msrest.serialization.Model): + """Specification of destinations that can be used in data flows. + + :param log_analytics: List of Log Analytics destinations. + :type log_analytics: list[~$(python-base- + namespace).v2019_11_01_preview.models.LogAnalyticsDestination] + :param azure_monitor_metrics: Azure Monitor Metrics destination. + :type azure_monitor_metrics: ~$(python-base- + namespace).v2019_11_01_preview.models.AzureMonitorMetricsDestination + """ + + _attribute_map = { + 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'AzureMonitorMetricsDestination'}, + } + + def __init__( + self, + *, + log_analytics: Optional[List["LogAnalyticsDestination"]] = None, + azure_monitor_metrics: Optional["AzureMonitorMetricsDestination"] = None, + **kwargs + ): + super(DestinationsSpec, self).__init__(**kwargs) + self.log_analytics = log_analytics + self.azure_monitor_metrics = azure_monitor_metrics + + +class DataCollectionRuleDestinations(DestinationsSpec): + """The specification of destinations. + + :param log_analytics: List of Log Analytics destinations. + :type log_analytics: list[~$(python-base- + namespace).v2019_11_01_preview.models.LogAnalyticsDestination] + :param azure_monitor_metrics: Azure Monitor Metrics destination. + :type azure_monitor_metrics: ~$(python-base- + namespace).v2019_11_01_preview.models.AzureMonitorMetricsDestination + """ + + _attribute_map = { + 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'AzureMonitorMetricsDestination'}, + } + + def __init__( + self, + *, + log_analytics: Optional[List["LogAnalyticsDestination"]] = None, + azure_monitor_metrics: Optional["AzureMonitorMetricsDestination"] = None, + **kwargs + ): + super(DataCollectionRuleDestinations, self).__init__(log_analytics=log_analytics, azure_monitor_metrics=azure_monitor_metrics, **kwargs) + + +class DataCollectionRuleResource(msrest.serialization.Model): + """Definition of ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :param description: Description of the data collection rule. + :type description: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec + :param destinations: Required. The specification of destinations. + :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec + :param data_flows: Required. The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'location': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'description': {'max_length': 256, 'min_length': 0}, + 'destinations': {'required': True}, + 'data_flows': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': 'DataSourcesSpec'}, + 'destinations': {'key': 'properties.destinations', 'type': 'DestinationsSpec'}, + 'data_flows': {'key': 'properties.dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + destinations: "DestinationsSpec", + data_flows: List["DataFlow"], + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + data_sources: Optional["DataSourcesSpec"] = None, + **kwargs + ): + super(DataCollectionRuleResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.id = None + self.name = None + self.type = None + self.etag = None + self.description = description + self.data_sources = data_sources + self.destinations = destinations + self.data_flows = data_flows + self.provisioning_state = None + + +class DataCollectionRuleResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: list[~$(python-base- + namespace).v2019_11_01_preview.models.DataCollectionRuleResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DataCollectionRuleResource"], + next_link: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DataCollectionRuleResourceProperties(DataCollectionRule): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the data collection rule. + :type description: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec + :param destinations: Required. The specification of destinations. + :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec + :param data_flows: Required. The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'description': {'max_length': 256, 'min_length': 0}, + 'destinations': {'required': True}, + 'data_flows': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSourcesSpec'}, + 'destinations': {'key': 'destinations', 'type': 'DestinationsSpec'}, + 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + destinations: "DestinationsSpec", + data_flows: List["DataFlow"], + description: Optional[str] = None, + data_sources: Optional["DataSourcesSpec"] = None, + **kwargs + ): + super(DataCollectionRuleResourceProperties, self).__init__(description=description, data_sources=data_sources, destinations=destinations, data_flows=data_flows, **kwargs) + + +class DataFlow(msrest.serialization.Model): + """Definition of which streams are sent to which destinations. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams for this data flow. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownDataFlowStreams] + :param destinations: Required. List of destinations for this data flow. + :type destinations: list[str] + """ + + _validation = { + 'streams': {'required': True}, + 'destinations': {'required': True}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'destinations': {'key': 'destinations', 'type': '[str]'}, + } + + def __init__( + self, + *, + streams: List[Union[str, "KnownDataFlowStreams"]], + destinations: List[str], + **kwargs + ): + super(DataFlow, self).__init__(**kwargs) + self.streams = streams + self.destinations = destinations + + +class DestinationsSpecAzureMonitorMetrics(AzureMonitorMetricsDestination): + """Azure Monitor Metrics destination. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(DestinationsSpecAzureMonitorMetrics, self).__init__(name=name, **kwargs) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """Additional information for common error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetails(msrest.serialization.Model): + """Common error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code which can be used to programmatically identify the class of error. + :vartype code: str + :ivar message: Describes the error in detail and provides debugging information. + :vartype message: str + :ivar target: The target of the particular error (for example, the name of the property in + error). + :vartype target: str + :ivar details: Additional nested error detail objects. + :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] + :ivar additional_info: Additional error information. + :vartype additional_info: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorDetailsAutoGenerated(msrest.serialization.Model): + """Common error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code which can be used to programmatically identify the class of error. + :vartype code: str + :ivar message: Describes the error in detail and provides debugging information. + :vartype message: str + :ivar target: The target of the particular error (for example, the name of the property in + error). + :vartype target: str + :ivar details: Additional nested error detail objects. + :vartype details: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] + :ivar additional_info: Additional error information. + :vartype additional_info: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetailsAutoGenerated, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Error details. + :vartype error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = None + + +class ErrorResponseAutoGenerated(msrest.serialization.Model): + """Common error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Error details. + :vartype error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetailsAutoGenerated'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseAutoGenerated, self).__init__(**kwargs) + self.error = None + + +class ErrorResponseError(ErrorDetails): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code which can be used to programmatically identify the class of error. + :vartype code: str + :ivar message: Describes the error in detail and provides debugging information. + :vartype message: str + :ivar target: The target of the particular error (for example, the name of the property in + error). + :vartype target: str + :ivar details: Additional nested error detail objects. + :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] + :ivar additional_info: Additional error information. + :vartype additional_info: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + + +class ErrorResponseErrorAutoGenerated(ErrorDetailsAutoGenerated): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code which can be used to programmatically identify the class of error. + :vartype code: str + :ivar message: Describes the error in detail and provides debugging information. + :vartype message: str + :ivar target: The target of the particular error (for example, the name of the property in + error). + :vartype target: str + :ivar details: Additional nested error detail objects. + :vartype details: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] + :ivar additional_info: Additional error information. + :vartype additional_info: list[~$(python-base- + namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseErrorAutoGenerated, self).__init__(**kwargs) + + +class ExtensionDataSource(msrest.serialization.Model): + """Definition of which data will be collected from a separate VM extension that integrates with the Azure Monitor Agent. +Collected from either Windows and Linux machines, depending on which extension is defined. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownExtensionDataSourceStreams] + :param extension_name: Required. The name of the VM extension. + :type extension_name: str + :param extension_settings: The extension settings. The format is specific for particular + extension. + :type extension_settings: object + :param name: Required. A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'streams': {'required': True}, + 'extension_name': {'required': True, 'max_length': 64, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'extension_name': {'key': 'extensionName', 'type': 'str'}, + 'extension_settings': {'key': 'extensionSettings', 'type': 'object'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + streams: List[Union[str, "KnownExtensionDataSourceStreams"]], + extension_name: str, + name: str, + extension_settings: Optional[object] = None, + **kwargs + ): + super(ExtensionDataSource, self).__init__(**kwargs) + self.streams = streams + self.extension_name = extension_name + self.extension_settings = extension_settings + self.name = name + + +class LogAnalyticsDestination(msrest.serialization.Model): + """Log Analytics destination. + + All required parameters must be populated in order to send to Azure. + + :param workspace_resource_id: Required. The resource ID of the Log Analytics workspace. + :type workspace_resource_id: str + :param name: Required. A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'workspace_resource_id': {'required': True}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + workspace_resource_id: str, + name: str, + **kwargs + ): + super(LogAnalyticsDestination, self).__init__(**kwargs) + self.workspace_resource_id = workspace_resource_id + self.name = name + + +class PerfCounterDataSource(msrest.serialization.Model): + """Definition of which performance counters will be collected and how they will be collected by this data collection rule. +Collected from both Windows and Linux machines where the counter is present. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceStreams] + :param scheduled_transfer_period: Required. The interval between data uploads (scheduled + transfers), rounded up to the nearest minute. Possible values include: "PT1M", "PT5M", "PT15M", + "PT30M", "PT60M". + :type scheduled_transfer_period: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceScheduledTransferPeriod + :param sampling_frequency_in_seconds: Required. The number of seconds between consecutive + counter measurements (samples). + :type sampling_frequency_in_seconds: int + :param counter_specifiers: Required. A list of specifier names of the performance counters you + want to collect. + Use a wildcard (*) to collect a counter for all instances. + To get a list of performance counters on Windows, run the command 'typeperf'. + :type counter_specifiers: list[str] + :param name: Required. A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'streams': {'required': True}, + 'scheduled_transfer_period': {'required': True}, + 'sampling_frequency_in_seconds': {'required': True, 'maximum': 30, 'minimum': 1}, + 'counter_specifiers': {'required': True}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'scheduled_transfer_period': {'key': 'scheduledTransferPeriod', 'type': 'str'}, + 'sampling_frequency_in_seconds': {'key': 'samplingFrequencyInSeconds', 'type': 'int'}, + 'counter_specifiers': {'key': 'counterSpecifiers', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + streams: List[Union[str, "KnownPerfCounterDataSourceStreams"]], + scheduled_transfer_period: Union[str, "KnownPerfCounterDataSourceScheduledTransferPeriod"], + sampling_frequency_in_seconds: int, + counter_specifiers: List[str], + name: str, + **kwargs + ): + super(PerfCounterDataSource, self).__init__(**kwargs) + self.streams = streams + self.scheduled_transfer_period = scheduled_transfer_period + self.sampling_frequency_in_seconds = sampling_frequency_in_seconds + self.counter_specifiers = counter_specifiers + self.name = name + + +class ResourceForUpdate(msrest.serialization.Model): + """Definition of ARM tracked top level resource properties for update operation. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceForUpdate, self).__init__(**kwargs) + self.tags = tags + + +class SyslogDataSource(msrest.serialization.Model): + """Definition of which syslog data will be collected and how it will be collected. +Only collected from Linux machines. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownSyslogDataSourceStreams] + :param facility_names: Required. The list of facility names. + :type facility_names: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownSyslogDataSourceFacilityNames] + :param log_levels: The log levels to collect. + :type log_levels: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownSyslogDataSourceLogLevels] + :param name: Required. A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'streams': {'required': True}, + 'facility_names': {'required': True}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'facility_names': {'key': 'facilityNames', 'type': '[str]'}, + 'log_levels': {'key': 'logLevels', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + streams: List[Union[str, "KnownSyslogDataSourceStreams"]], + facility_names: List[Union[str, "KnownSyslogDataSourceFacilityNames"]], + name: str, + log_levels: Optional[List[Union[str, "KnownSyslogDataSourceLogLevels"]]] = None, + **kwargs + ): + super(SyslogDataSource, self).__init__(**kwargs) + self.streams = streams + self.facility_names = facility_names + self.log_levels = log_levels + self.name = name + + +class WindowsEventLogDataSource(msrest.serialization.Model): + """Definition of which Windows Event Log events will be collected and how they will be collected. +Only collected from Windows machines. + + All required parameters must be populated in order to send to Azure. + + :param streams: Required. List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceStreams] + :param scheduled_transfer_period: Required. The interval between data uploads (scheduled + transfers), rounded up to the nearest minute. Possible values include: "PT1M", "PT5M", "PT15M", + "PT30M", "PT60M". + :type scheduled_transfer_period: str or ~$(python-base- + namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceScheduledTransferPeriod + :param x_path_queries: Required. A list of Windows Event Log queries in XPATH format. + :type x_path_queries: list[str] + :param name: Required. A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'streams': {'required': True}, + 'scheduled_transfer_period': {'required': True}, + 'x_path_queries': {'required': True}, + 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'scheduled_transfer_period': {'key': 'scheduledTransferPeriod', 'type': 'str'}, + 'x_path_queries': {'key': 'xPathQueries', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + streams: List[Union[str, "KnownWindowsEventLogDataSourceStreams"]], + scheduled_transfer_period: Union[str, "KnownWindowsEventLogDataSourceScheduledTransferPeriod"], + x_path_queries: List[str], + name: str, + **kwargs + ): + super(WindowsEventLogDataSource, self).__init__(**kwargs) + self.streams = streams + self.scheduled_transfer_period = scheduled_transfer_period + self.x_path_queries = x_path_queries + self.name = name diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_client_enums.py new file mode 100644 index 0000000000000..2308243d3ed4e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_client_enums.py @@ -0,0 +1,161 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class KnownDataCollectionRuleAssociationProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The resource provisioning state. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class KnownDataCollectionRuleProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The resource provisioning state. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class KnownDataFlowStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_ANTI_MALWARE_STATUS = "Microsoft-AntiMalwareStatus" + MICROSOFT_AUDITD = "Microsoft-Auditd" + MICROSOFT_CISCOASA = "Microsoft-CISCOASA" + MICROSOFT_COMMON_SECURITY_LOG = "Microsoft-CommonSecurityLog" + MICROSOFT_COMPUTER_GROUP = "Microsoft-ComputerGroup" + MICROSOFT_EVENT = "Microsoft-Event" + MICROSOFT_FIREWALL_LOG = "Microsoft-FirewallLog" + MICROSOFT_HEALTH_STATE_CHANGE = "Microsoft-HealthStateChange" + MICROSOFT_HEARTBEAT = "Microsoft-Heartbeat" + MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" + MICROSOFT_OPERATION_LOG = "Microsoft-OperationLog" + MICROSOFT_PERF = "Microsoft-Perf" + MICROSOFT_PROCESS_INVESTIGATOR = "Microsoft-ProcessInvestigator" + MICROSOFT_PROTECTION_STATUS = "Microsoft-ProtectionStatus" + MICROSOFT_ROME_DETECTION_EVENT = "Microsoft-RomeDetectionEvent" + MICROSOFT_SECURITY_BASELINE = "Microsoft-SecurityBaseline" + MICROSOFT_SECURITY_BASELINE_SUMMARY = "Microsoft-SecurityBaselineSummary" + MICROSOFT_SECURITY_EVENT = "Microsoft-SecurityEvent" + MICROSOFT_SYSLOG = "Microsoft-Syslog" + MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" + +class KnownExtensionDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_ANTI_MALWARE_STATUS = "Microsoft-AntiMalwareStatus" + MICROSOFT_AUDITD = "Microsoft-Auditd" + MICROSOFT_CISCOASA = "Microsoft-CISCOASA" + MICROSOFT_COMMON_SECURITY_LOG = "Microsoft-CommonSecurityLog" + MICROSOFT_COMPUTER_GROUP = "Microsoft-ComputerGroup" + MICROSOFT_EVENT = "Microsoft-Event" + MICROSOFT_FIREWALL_LOG = "Microsoft-FirewallLog" + MICROSOFT_HEALTH_STATE_CHANGE = "Microsoft-HealthStateChange" + MICROSOFT_HEARTBEAT = "Microsoft-Heartbeat" + MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" + MICROSOFT_OPERATION_LOG = "Microsoft-OperationLog" + MICROSOFT_PERF = "Microsoft-Perf" + MICROSOFT_PROCESS_INVESTIGATOR = "Microsoft-ProcessInvestigator" + MICROSOFT_PROTECTION_STATUS = "Microsoft-ProtectionStatus" + MICROSOFT_ROME_DETECTION_EVENT = "Microsoft-RomeDetectionEvent" + MICROSOFT_SECURITY_BASELINE = "Microsoft-SecurityBaseline" + MICROSOFT_SECURITY_BASELINE_SUMMARY = "Microsoft-SecurityBaselineSummary" + MICROSOFT_SECURITY_EVENT = "Microsoft-SecurityEvent" + MICROSOFT_SYSLOG = "Microsoft-Syslog" + MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" + +class KnownPerfCounterDataSourceScheduledTransferPeriod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The interval between data uploads (scheduled transfers), rounded up to the nearest minute. + """ + + PT1_M = "PT1M" + PT5_M = "PT5M" + PT15_M = "PT15M" + PT30_M = "PT30M" + PT60_M = "PT60M" + +class KnownPerfCounterDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_PERF = "Microsoft-Perf" + MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" + +class KnownSyslogDataSourceFacilityNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + AUTH = "auth" + AUTHPRIV = "authpriv" + CRON = "cron" + DAEMON = "daemon" + KERN = "kern" + LPR = "lpr" + MAIL = "mail" + MARK = "mark" + NEWS = "news" + SYSLOG = "syslog" + USER = "user" + UUCP = "UUCP" + LOCAL0 = "local0" + LOCAL1 = "local1" + LOCAL2 = "local2" + LOCAL3 = "local3" + LOCAL4 = "local4" + LOCAL5 = "local5" + LOCAL6 = "local6" + LOCAL7 = "local7" + +class KnownSyslogDataSourceLogLevels(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DEBUG = "Debug" + INFO = "Info" + NOTICE = "Notice" + WARNING = "Warning" + ERROR = "Error" + CRITICAL = "Critical" + ALERT = "Alert" + EMERGENCY = "Emergency" + +class KnownSyslogDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_SYSLOG = "Microsoft-Syslog" + +class KnownWindowsEventLogDataSourceScheduledTransferPeriod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The interval between data uploads (scheduled transfers), rounded up to the nearest minute. + """ + + PT1_M = "PT1M" + PT5_M = "PT5M" + PT15_M = "PT15M" + PT30_M = "PT30M" + PT60_M = "PT60M" + +class KnownWindowsEventLogDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" + MICROSOFT_EVENT = "Microsoft-Event" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..f755a04ab0654 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_collection_rule_associations_operations import DataCollectionRuleAssociationsOperations +from ._data_collection_rules_operations import DataCollectionRulesOperations + +__all__ = [ + 'DataCollectionRuleAssociationsOperations', + 'DataCollectionRulesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py new file mode 100644 index 0000000000000..7217c7daf6436 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py @@ -0,0 +1,393 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionRuleAssociationsOperations(object): + """DataCollectionRuleAssociationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2019_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource( + self, + resource_uri, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + """Lists associations for the specified resource. + + Lists associations for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + + def list_by_rule( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + """Lists associations for the specified data collection rule. + + Lists associations for the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + + def get( + self, + resource_uri, # type: str + association_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleAssociationProxyOnlyResource" + """Returns the specified association. + + Returns the specified association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + + def create( + self, + resource_uri, # type: str + association_name, # type: str + body=None, # type: Optional["_models.DataCollectionRuleAssociationProxyOnlyResource"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleAssociationProxyOnlyResource" + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. + :type association_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionRuleAssociationProxyOnlyResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + + def delete( + self, + resource_uri, # type: str + association_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an association. + + Deletes an association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py new file mode 100644 index 0000000000000..9f555f1455d12 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py @@ -0,0 +1,465 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionRulesOperations(object): + """DataCollectionRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2019_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionRuleResourceListResult"] + """Lists all data collection rules in the specified resource group. + + Lists all data collection rules in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionRuleResourceListResult"] + """Lists all data collection rules in the specified subscription. + + Lists all data collection rules in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + + def get( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleResource" + """Returns the specified data collection rule. + + Returns the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + def create( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + body=None, # type: Optional["_models.DataCollectionRuleResource"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleResource" + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionRuleResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + body=None, # type: Optional["_models.ResourceForUpdate"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleResource" + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2019_11_01_preview.models.ResourceForUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'ResourceForUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a data collection rule. + + Deletes a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/py.typed b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py index 7eb739ad65a6b..40a30732e6b8f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py @@ -43,7 +43,7 @@ def __init__( self.credential = credential self.api_version = "2020-01-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json index b801d74bf6ca4..0e184819af2c1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_client.py index 91f0fd5aed89b..0a44a2308e031 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_client.py @@ -46,7 +46,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py index 9fc93fa75bffc..f2814440fdb47 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py @@ -40,7 +40,7 @@ def __init__( self.credential = credential self.api_version = "2020-01-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_client.py index 1d880d8d1aeea..0cb96dc6dedd8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_client.py @@ -43,7 +43,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py index cb67e01cbfc83..8ee8b141d0128 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ManagementGroupDiagnosticSettingsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def get( management_group_id: str, name: str, **kwargs - ) -> "models.ManagementGroupDiagnosticSettingsResource": + ) -> "_models.ManagementGroupDiagnosticSettingsResource": """Gets the active management group diagnostic settings for the specified resource. :param management_group_id: The management group id. @@ -58,7 +58,7 @@ async def get( :rtype: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -88,7 +88,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) @@ -103,9 +103,9 @@ async def create_or_update( self, management_group_id: str, name: str, - parameters: "models.ManagementGroupDiagnosticSettingsResource", + parameters: "_models.ManagementGroupDiagnosticSettingsResource", **kwargs - ) -> "models.ManagementGroupDiagnosticSettingsResource": + ) -> "_models.ManagementGroupDiagnosticSettingsResource": """Creates or updates management group diagnostic settings for the specified resource. :param management_group_id: The management group id. @@ -119,7 +119,7 @@ async def create_or_update( :rtype: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) @@ -212,7 +212,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -224,7 +224,7 @@ def list( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.ManagementGroupDiagnosticSettingsResourceCollection"]: + ) -> AsyncIterable["_models.ManagementGroupDiagnosticSettingsResourceCollection"]: """Gets the active management group diagnostic settings list for the specified management group. :param management_group_id: The management group id. @@ -234,7 +234,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -279,7 +279,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py index b1054afd8e9c1..9f9bdc045e1b8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ManagementGroupDiagnosticSettingsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def get( name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagementGroupDiagnosticSettingsResource" + # type: (...) -> "_models.ManagementGroupDiagnosticSettingsResource" """Gets the active management group diagnostic settings for the specified resource. :param management_group_id: The management group id. @@ -63,7 +63,7 @@ def get( :rtype: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -93,7 +93,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) @@ -108,10 +108,10 @@ def create_or_update( self, management_group_id, # type: str name, # type: str - parameters, # type: "models.ManagementGroupDiagnosticSettingsResource" + parameters, # type: "_models.ManagementGroupDiagnosticSettingsResource" **kwargs # type: Any ): - # type: (...) -> "models.ManagementGroupDiagnosticSettingsResource" + # type: (...) -> "_models.ManagementGroupDiagnosticSettingsResource" """Creates or updates management group diagnostic settings for the specified resource. :param management_group_id: The management group id. @@ -125,7 +125,7 @@ def create_or_update( :rtype: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,7 +160,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) @@ -219,7 +219,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -232,7 +232,7 @@ def list( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagementGroupDiagnosticSettingsResourceCollection"] + # type: (...) -> Iterable["_models.ManagementGroupDiagnosticSettingsResourceCollection"] """Gets the active management group diagnostic settings list for the specified management group. :param management_group_id: The management group id. @@ -242,7 +242,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResourceCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -287,7 +287,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py new file mode 100644 index 0000000000000..fa63968b37592 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py new file mode 100644 index 0000000000000..dab590d5f4ce3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-05-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json new file mode 100644 index 0000000000000..bcf965e81eff4 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json @@ -0,0 +1,61 @@ +{ + "chosen_version": "2020-05-01-preview", + "total_api_version_list": ["2020-05-01-preview"], + "client": { + "name": "MonitorClient", + "filename": "_monitor_client", + "description": "Monitor Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": true + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "scheduled_query_rules": "ScheduledQueryRulesOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_client.py new file mode 100644 index 0000000000000..439226f76ba48 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_client.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import MonitorClientConfiguration +from .operations import ScheduledQueryRulesOperations +from . import models + + +class MonitorClient(object): + """Monitor Management Client. + + :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations + :vartype scheduled_query_rules: $(python-base-namespace).v2020_05_01_preview.operations.ScheduledQueryRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.scheduled_query_rules = ScheduledQueryRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> MonitorClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/__init__.py new file mode 100644 index 0000000000000..7096a59fbc1f0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py new file mode 100644 index 0000000000000..d3eff86218f9d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-05-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_client.py new file mode 100644 index 0000000000000..b4ab0fa33042d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_client.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import MonitorClientConfiguration +from .operations import ScheduledQueryRulesOperations +from .. import models + + +class MonitorClient(object): + """Monitor Management Client. + + :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations + :vartype scheduled_query_rules: $(python-base-namespace).v2020_05_01_preview.aio.operations.ScheduledQueryRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.scheduled_query_rules = ScheduledQueryRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MonitorClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/__init__.py new file mode 100644 index 0000000000000..f677702ed3df4 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._scheduled_query_rules_operations import ScheduledQueryRulesOperations + +__all__ = [ + 'ScheduledQueryRulesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py new file mode 100644 index 0000000000000..00518fa8b596e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py @@ -0,0 +1,433 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ScheduledQueryRulesOperations: + """ScheduledQueryRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2020_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.ScheduledQueryRuleResourceCollection"]: + """Retrieve a scheduled query rule definitions in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScheduledQueryRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ScheduledQueryRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.ScheduledQueryRuleResourceCollection"]: + """Retrieve scheduled query rule definitions in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScheduledQueryRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ScheduledQueryRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + + async def get( + self, + resource_group_name: str, + rule_name: str, + **kwargs + ) -> "_models.ScheduledQueryRuleResource": + """Retrieve an scheduled query rule definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + rule_name: str, + parameters: "_models.ScheduledQueryRuleResource", + **kwargs + ) -> "_models.ScheduledQueryRuleResource": + """Creates or updates a scheduled query rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + rule_name: str, + parameters: "_models.ScheduledQueryRuleResourcePatch", + **kwargs + ) -> "_models.ScheduledQueryRuleResource": + """Update a scheduled query rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to update. + :type parameters: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResourcePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + rule_name: str, + **kwargs + ) -> None: + """Deletes a scheduled query rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py new file mode 100644 index 0000000000000..58149d4e6127e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Action + from ._models_py3 import Condition + from ._models_py3 import ConditionFailingPeriods + from ._models_py3 import Dimension + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorContract + from ._models_py3 import ErrorResponse + from ._models_py3 import Resource + from ._models_py3 import ScheduledQueryRuleCriteria + from ._models_py3 import ScheduledQueryRuleResource + from ._models_py3 import ScheduledQueryRuleResourceCollection + from ._models_py3 import ScheduledQueryRuleResourcePatch + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import Action # type: ignore + from ._models import Condition # type: ignore + from ._models import ConditionFailingPeriods # type: ignore + from ._models import Dimension # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorContract # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import Resource # type: ignore + from ._models import ScheduledQueryRuleCriteria # type: ignore + from ._models import ScheduledQueryRuleResource # type: ignore + from ._models import ScheduledQueryRuleResourceCollection # type: ignore + from ._models import ScheduledQueryRuleResourcePatch # type: ignore + from ._models import TrackedResource # type: ignore + +from ._monitor_client_enums import ( + AlertSeverity, + ConditionOperator, + DimensionOperator, + TimeAggregation, +) + +__all__ = [ + 'Action', + 'Condition', + 'ConditionFailingPeriods', + 'Dimension', + 'ErrorAdditionalInfo', + 'ErrorContract', + 'ErrorResponse', + 'Resource', + 'ScheduledQueryRuleCriteria', + 'ScheduledQueryRuleResource', + 'ScheduledQueryRuleResourceCollection', + 'ScheduledQueryRuleResourcePatch', + 'TrackedResource', + 'AlertSeverity', + 'ConditionOperator', + 'DimensionOperator', + 'TimeAggregation', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py new file mode 100644 index 0000000000000..65721a94a4ca4 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py @@ -0,0 +1,530 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Action(msrest.serialization.Model): + """Actions to invoke when the alert fires. + + :param action_group_id: Action Group resource Id to invoke when the alert fires. + :type action_group_id: str + :param web_hook_properties: The properties of a webhook object. + :type web_hook_properties: dict[str, str] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'web_hook_properties': {'key': 'webHookProperties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.action_group_id = kwargs.get('action_group_id', None) + self.web_hook_properties = kwargs.get('web_hook_properties', None) + + +class Condition(msrest.serialization.Model): + """A condition of the scheduled query rule. + + All required parameters must be populated in order to send to Azure. + + :param query: Log query alert. + :type query: str + :param time_aggregation: Required. Aggregation type. Possible values include: "Count", + "Average", "Minimum", "Maximum", "Total". + :type time_aggregation: str or ~$(python-base- + namespace).v2020_05_01_preview.models.TimeAggregation + :param metric_measure_column: The column containing the metric measure number. + :type metric_measure_column: str + :param resource_id_column: The column containing the resource id. The content of the column + must be a uri formatted as resource id. + :type resource_id_column: str + :param dimensions: List of Dimensions conditions. + :type dimensions: list[~$(python-base-namespace).v2020_05_01_preview.models.Dimension] + :param operator: Required. The criteria operator. Possible values include: "Equals", + "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2020_05_01_preview.models.ConditionOperator + :param threshold: Required. the criteria threshold value that activates the alert. + :type threshold: float + :param failing_periods: The minimum number of violations required within the selected lookback + time window required to raise an alert. + :type failing_periods: ~$(python-base- + namespace).v2020_05_01_preview.models.ConditionFailingPeriods + """ + + _validation = { + 'time_aggregation': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, + 'metric_measure_column': {'key': 'metricMeasureColumn', 'type': 'str'}, + 'resource_id_column': {'key': 'resourceIdColumn', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'failing_periods': {'key': 'failingPeriods', 'type': 'ConditionFailingPeriods'}, + } + + def __init__( + self, + **kwargs + ): + super(Condition, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.time_aggregation = kwargs['time_aggregation'] + self.metric_measure_column = kwargs.get('metric_measure_column', None) + self.resource_id_column = kwargs.get('resource_id_column', None) + self.dimensions = kwargs.get('dimensions', None) + self.operator = kwargs['operator'] + self.threshold = kwargs['threshold'] + self.failing_periods = kwargs.get('failing_periods', None) + + +class ConditionFailingPeriods(msrest.serialization.Model): + """The minimum number of violations required within the selected lookback time window required to raise an alert. + + :param number_of_evaluation_periods: The number of aggregated lookback points. The lookback + time window is calculated based on the aggregation granularity (windowSize) and the selected + number of aggregated points. Default value is 1. + :type number_of_evaluation_periods: long + :param min_failing_periods_to_alert: The number of violations to trigger an alert. Should be + smaller or equal to numberOfEvaluationPeriods. Default value is 1. + :type min_failing_periods_to_alert: long + """ + + _attribute_map = { + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'long'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(ConditionFailingPeriods, self).__init__(**kwargs) + self.number_of_evaluation_periods = kwargs.get('number_of_evaluation_periods', 1) + self.min_failing_periods_to_alert = kwargs.get('min_failing_periods_to_alert', 1) + + +class Dimension(msrest.serialization.Model): + """Dimension splitting and filtering definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param operator: Required. Operator for dimension values. Possible values include: "Include", + "Exclude". + :type operator: str or ~$(python-base-namespace).v2020_05_01_preview.models.DimensionOperator + :param values: Required. List of dimension values. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(Dimension, self).__init__(**kwargs) + self.name = kwargs['name'] + self.operator = kwargs['operator'] + self.values = kwargs['values'] + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorContract(msrest.serialization.Model): + """Describes the format of Error response. + + :param error: The error details. + :type error: ~$(python-base-namespace).v2020_05_01_preview.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorContract, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~$(python-base-namespace).v2020_05_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~$(python-base- + namespace).v2020_05_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ScheduledQueryRuleCriteria(msrest.serialization.Model): + """The rule criteria that defines the conditions of the scheduled query rule. + + :param all_of: A list of conditions to evaluate against the specified scopes. + :type all_of: list[~$(python-base-namespace).v2020_05_01_preview.models.Condition] + """ + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[Condition]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledQueryRuleCriteria, self).__init__(**kwargs) + self.all_of = kwargs.get('all_of', None) + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class ScheduledQueryRuleResource(TrackedResource): + """The scheduled query rule resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param description: The description of the scheduled query rule. + :type description: str + :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Possible values include: 0, 1, 2, 3, 4. + :type severity: str or ~$(python-base-namespace).v2020_05_01_preview.models.AlertSeverity + :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. + :type enabled: bool + :param scopes: The list of resource id's that this scheduled query rule is scoped to. + :type scopes: list[str] + :param evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. + :type evaluation_frequency: ~datetime.timedelta + :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). + :type window_size: ~datetime.timedelta + :param target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. + :type target_resource_types: list[str] + :param criteria: The rule criteria that defines the conditions of the scheduled query rule. + :type criteria: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. + :type mute_actions_duration: ~datetime.timedelta + :param actions: + :type actions: list[~$(python-base-namespace).v2020_05_01_preview.models.Action] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'float'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, + 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, + 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledQueryRuleResource, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.severity = kwargs.get('severity', None) + self.enabled = kwargs.get('enabled', None) + self.scopes = kwargs.get('scopes', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.window_size = kwargs.get('window_size', None) + self.target_resource_types = kwargs.get('target_resource_types', None) + self.criteria = kwargs.get('criteria', None) + self.mute_actions_duration = kwargs.get('mute_actions_duration', None) + self.actions = kwargs.get('actions', None) + + +class ScheduledQueryRuleResourceCollection(msrest.serialization.Model): + """Represents a collection of scheduled query rule resources. + + :param value: The values for the scheduled query rule resources. + :type value: list[~$(python-base- + namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScheduledQueryRuleResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledQueryRuleResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): + """The scheduled query rule resource for patch operations. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param description: The description of the scheduled query rule. + :type description: str + :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Possible values include: 0, 1, 2, 3, 4. + :type severity: str or ~$(python-base-namespace).v2020_05_01_preview.models.AlertSeverity + :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. + :type enabled: bool + :param scopes: The list of resource id's that this scheduled query rule is scoped to. + :type scopes: list[str] + :param evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. + :type evaluation_frequency: ~datetime.timedelta + :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). + :type window_size: ~datetime.timedelta + :param target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. + :type target_resource_types: list[str] + :param criteria: The rule criteria that defines the conditions of the scheduled query rule. + :type criteria: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. + :type mute_actions_duration: ~datetime.timedelta + :param actions: + :type actions: list[~$(python-base-namespace).v2020_05_01_preview.models.Action] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'float'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, + 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, + 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledQueryRuleResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.description = kwargs.get('description', None) + self.severity = kwargs.get('severity', None) + self.enabled = kwargs.get('enabled', None) + self.scopes = kwargs.get('scopes', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.window_size = kwargs.get('window_size', None) + self.target_resource_types = kwargs.get('target_resource_types', None) + self.criteria = kwargs.get('criteria', None) + self.mute_actions_duration = kwargs.get('mute_actions_duration', None) + self.actions = kwargs.get('actions', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..8a32c3553f845 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py @@ -0,0 +1,588 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._monitor_client_enums import * + + +class Action(msrest.serialization.Model): + """Actions to invoke when the alert fires. + + :param action_group_id: Action Group resource Id to invoke when the alert fires. + :type action_group_id: str + :param web_hook_properties: The properties of a webhook object. + :type web_hook_properties: dict[str, str] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'web_hook_properties': {'key': 'webHookProperties', 'type': '{str}'}, + } + + def __init__( + self, + *, + action_group_id: Optional[str] = None, + web_hook_properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.action_group_id = action_group_id + self.web_hook_properties = web_hook_properties + + +class Condition(msrest.serialization.Model): + """A condition of the scheduled query rule. + + All required parameters must be populated in order to send to Azure. + + :param query: Log query alert. + :type query: str + :param time_aggregation: Required. Aggregation type. Possible values include: "Count", + "Average", "Minimum", "Maximum", "Total". + :type time_aggregation: str or ~$(python-base- + namespace).v2020_05_01_preview.models.TimeAggregation + :param metric_measure_column: The column containing the metric measure number. + :type metric_measure_column: str + :param resource_id_column: The column containing the resource id. The content of the column + must be a uri formatted as resource id. + :type resource_id_column: str + :param dimensions: List of Dimensions conditions. + :type dimensions: list[~$(python-base-namespace).v2020_05_01_preview.models.Dimension] + :param operator: Required. The criteria operator. Possible values include: "Equals", + "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2020_05_01_preview.models.ConditionOperator + :param threshold: Required. the criteria threshold value that activates the alert. + :type threshold: float + :param failing_periods: The minimum number of violations required within the selected lookback + time window required to raise an alert. + :type failing_periods: ~$(python-base- + namespace).v2020_05_01_preview.models.ConditionFailingPeriods + """ + + _validation = { + 'time_aggregation': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, + 'metric_measure_column': {'key': 'metricMeasureColumn', 'type': 'str'}, + 'resource_id_column': {'key': 'resourceIdColumn', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'failing_periods': {'key': 'failingPeriods', 'type': 'ConditionFailingPeriods'}, + } + + def __init__( + self, + *, + time_aggregation: Union[str, "TimeAggregation"], + operator: Union[str, "ConditionOperator"], + threshold: float, + query: Optional[str] = None, + metric_measure_column: Optional[str] = None, + resource_id_column: Optional[str] = None, + dimensions: Optional[List["Dimension"]] = None, + failing_periods: Optional["ConditionFailingPeriods"] = None, + **kwargs + ): + super(Condition, self).__init__(**kwargs) + self.query = query + self.time_aggregation = time_aggregation + self.metric_measure_column = metric_measure_column + self.resource_id_column = resource_id_column + self.dimensions = dimensions + self.operator = operator + self.threshold = threshold + self.failing_periods = failing_periods + + +class ConditionFailingPeriods(msrest.serialization.Model): + """The minimum number of violations required within the selected lookback time window required to raise an alert. + + :param number_of_evaluation_periods: The number of aggregated lookback points. The lookback + time window is calculated based on the aggregation granularity (windowSize) and the selected + number of aggregated points. Default value is 1. + :type number_of_evaluation_periods: long + :param min_failing_periods_to_alert: The number of violations to trigger an alert. Should be + smaller or equal to numberOfEvaluationPeriods. Default value is 1. + :type min_failing_periods_to_alert: long + """ + + _attribute_map = { + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'long'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'long'}, + } + + def __init__( + self, + *, + number_of_evaluation_periods: Optional[int] = 1, + min_failing_periods_to_alert: Optional[int] = 1, + **kwargs + ): + super(ConditionFailingPeriods, self).__init__(**kwargs) + self.number_of_evaluation_periods = number_of_evaluation_periods + self.min_failing_periods_to_alert = min_failing_periods_to_alert + + +class Dimension(msrest.serialization.Model): + """Dimension splitting and filtering definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param operator: Required. Operator for dimension values. Possible values include: "Include", + "Exclude". + :type operator: str or ~$(python-base-namespace).v2020_05_01_preview.models.DimensionOperator + :param values: Required. List of dimension values. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: str, + operator: Union[str, "DimensionOperator"], + values: List[str], + **kwargs + ): + super(Dimension, self).__init__(**kwargs) + self.name = name + self.operator = operator + self.values = values + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorContract(msrest.serialization.Model): + """Describes the format of Error response. + + :param error: The error details. + :type error: ~$(python-base-namespace).v2020_05_01_preview.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponse"] = None, + **kwargs + ): + super(ErrorContract, self).__init__(**kwargs) + self.error = error + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~$(python-base-namespace).v2020_05_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~$(python-base- + namespace).v2020_05_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ScheduledQueryRuleCriteria(msrest.serialization.Model): + """The rule criteria that defines the conditions of the scheduled query rule. + + :param all_of: A list of conditions to evaluate against the specified scopes. + :type all_of: list[~$(python-base-namespace).v2020_05_01_preview.models.Condition] + """ + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[Condition]'}, + } + + def __init__( + self, + *, + all_of: Optional[List["Condition"]] = None, + **kwargs + ): + super(ScheduledQueryRuleCriteria, self).__init__(**kwargs) + self.all_of = all_of + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class ScheduledQueryRuleResource(TrackedResource): + """The scheduled query rule resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param description: The description of the scheduled query rule. + :type description: str + :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Possible values include: 0, 1, 2, 3, 4. + :type severity: str or ~$(python-base-namespace).v2020_05_01_preview.models.AlertSeverity + :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. + :type enabled: bool + :param scopes: The list of resource id's that this scheduled query rule is scoped to. + :type scopes: list[str] + :param evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. + :type evaluation_frequency: ~datetime.timedelta + :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). + :type window_size: ~datetime.timedelta + :param target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. + :type target_resource_types: list[str] + :param criteria: The rule criteria that defines the conditions of the scheduled query rule. + :type criteria: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. + :type mute_actions_duration: ~datetime.timedelta + :param actions: + :type actions: list[~$(python-base-namespace).v2020_05_01_preview.models.Action] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'float'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, + 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, + 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + severity: Optional[Union[float, "AlertSeverity"]] = None, + enabled: Optional[bool] = None, + scopes: Optional[List[str]] = None, + evaluation_frequency: Optional[datetime.timedelta] = None, + window_size: Optional[datetime.timedelta] = None, + target_resource_types: Optional[List[str]] = None, + criteria: Optional["ScheduledQueryRuleCriteria"] = None, + mute_actions_duration: Optional[datetime.timedelta] = None, + actions: Optional[List["Action"]] = None, + **kwargs + ): + super(ScheduledQueryRuleResource, self).__init__(tags=tags, location=location, **kwargs) + self.description = description + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.target_resource_types = target_resource_types + self.criteria = criteria + self.mute_actions_duration = mute_actions_duration + self.actions = actions + + +class ScheduledQueryRuleResourceCollection(msrest.serialization.Model): + """Represents a collection of scheduled query rule resources. + + :param value: The values for the scheduled query rule resources. + :type value: list[~$(python-base- + namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScheduledQueryRuleResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["ScheduledQueryRuleResource"]] = None, + **kwargs + ): + super(ScheduledQueryRuleResourceCollection, self).__init__(**kwargs) + self.value = value + + +class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): + """The scheduled query rule resource for patch operations. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param description: The description of the scheduled query rule. + :type description: str + :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Possible values include: 0, 1, 2, 3, 4. + :type severity: str or ~$(python-base-namespace).v2020_05_01_preview.models.AlertSeverity + :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. + :type enabled: bool + :param scopes: The list of resource id's that this scheduled query rule is scoped to. + :type scopes: list[str] + :param evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. + :type evaluation_frequency: ~datetime.timedelta + :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). + :type window_size: ~datetime.timedelta + :param target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. + :type target_resource_types: list[str] + :param criteria: The rule criteria that defines the conditions of the scheduled query rule. + :type criteria: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. + :type mute_actions_duration: ~datetime.timedelta + :param actions: + :type actions: list[~$(python-base-namespace).v2020_05_01_preview.models.Action] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'float'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, + 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, + 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + severity: Optional[Union[float, "AlertSeverity"]] = None, + enabled: Optional[bool] = None, + scopes: Optional[List[str]] = None, + evaluation_frequency: Optional[datetime.timedelta] = None, + window_size: Optional[datetime.timedelta] = None, + target_resource_types: Optional[List[str]] = None, + criteria: Optional["ScheduledQueryRuleCriteria"] = None, + mute_actions_duration: Optional[datetime.timedelta] = None, + actions: Optional[List["Action"]] = None, + **kwargs + ): + super(ScheduledQueryRuleResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.description = description + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.target_resource_types = target_resource_types + self.criteria = criteria + self.mute_actions_duration = mute_actions_duration + self.actions = actions diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_client_enums.py new file mode 100644 index 0000000000000..824ade35f9c68 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_client_enums.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, float, Enum)): + """Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest + """ + + ZERO = 0 + ONE = 1 + TWO = 2 + THREE = 3 + FOUR = 4 + +class ConditionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The criteria operator. + """ + + EQUALS = "Equals" + GREATER_THAN = "GreaterThan" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + LESS_THAN = "LessThan" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" + +class DimensionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Operator for dimension values + """ + + INCLUDE = "Include" + EXCLUDE = "Exclude" + +class TimeAggregation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Aggregation type + """ + + COUNT = "Count" + AVERAGE = "Average" + MINIMUM = "Minimum" + MAXIMUM = "Maximum" + TOTAL = "Total" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..f677702ed3df4 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._scheduled_query_rules_operations import ScheduledQueryRulesOperations + +__all__ = [ + 'ScheduledQueryRulesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py new file mode 100644 index 0000000000000..2fb3b6b14f460 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py @@ -0,0 +1,443 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ScheduledQueryRulesOperations(object): + """ScheduledQueryRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2020_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScheduledQueryRuleResourceCollection"] + """Retrieve a scheduled query rule definitions in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScheduledQueryRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ScheduledQueryRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScheduledQueryRuleResourceCollection"] + """Retrieve scheduled query rule definitions in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScheduledQueryRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ScheduledQueryRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + + def get( + self, + resource_group_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ScheduledQueryRuleResource" + """Retrieve an scheduled query rule definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + rule_name, # type: str + parameters, # type: "_models.ScheduledQueryRuleResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ScheduledQueryRuleResource" + """Creates or updates a scheduled query rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + rule_name, # type: str + parameters, # type: "_models.ScheduledQueryRuleResourcePatch" + **kwargs # type: Any + ): + # type: (...) -> "_models.ScheduledQueryRuleResource" + """Update a scheduled query rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to update. + :type parameters: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResourcePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a scheduled query rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/py.typed b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file