From 3c7f6fb44045819fc34cd5f0300994c39c3f32e4 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 2 Jul 2020 02:50:29 +0000 Subject: [PATCH] Generated from c157b38be4b47ad03707e1be06d2d079d5266dc5 keeping location --- .../azure/mgmt/monitor/_monitor_client.py | 31 ++ .../mgmt/monitor/aio/_monitor_client_async.py | 31 ++ .../_activity_logs_operations_async.py | 12 +- .../_autoscale_settings_operations_async.py | 29 +- .../_event_categories_operations_async.py | 12 +- .../aio/operations_async/_operations_async.py | 1 - .../_tenant_activity_logs_operations_async.py | 12 +- .../operations/_activity_logs_operations.py | 12 +- .../_autoscale_settings_operations.py | 29 +- .../_event_categories_operations.py | 12 +- .../v2015_04_01/operations/_operations.py | 1 - .../_tenant_activity_logs_operations.py | 12 +- ...ce_diagnostic_settings_operations_async.py | 2 - ..._service_diagnostic_settings_operations.py | 2 - .../_alert_rule_incidents_operations_async.py | 13 +- .../_alert_rules_operations_async.py | 30 +- .../_log_profiles_operations_async.py | 16 +- .../_metric_definitions_operations_async.py | 12 +- .../_alert_rule_incidents_operations.py | 13 +- .../operations/_alert_rules_operations.py | 30 +- .../operations/_log_profiles_operations.py | 16 +- .../_metric_definitions_operations.py | 12 +- .../_metrics_operations_async.py | 12 +- ...ce_diagnostic_settings_operations_async.py | 3 - .../operations/_metrics_operations.py | 12 +- ..._service_diagnostic_settings_operations.py | 3 - .../_activity_log_alerts_operations_async.py | 29 +- .../_activity_log_alerts_operations.py | 29 +- .../_action_groups_operations_async.py | 30 +- .../_activity_log_alerts_operations_async.py | 29 +- .../operations/_action_groups_operations.py | 30 +- .../_activity_log_alerts_operations.py | 29 +- .../v2017_05_01_preview/_metadata.json | 3 +- .../v2017_05_01_preview/_monitor_client.py | 5 + .../aio/_monitor_client_async.py | 5 + .../aio/operations_async/__init__.py | 2 + ...stic_settings_category_operations_async.py | 2 - .../_diagnostic_settings_operations_async.py | 4 - .../_metric_definitions_operations_async.py | 12 +- .../_metrics_operations_async.py | 1 - ...on_diagnostic_settings_operations_async.py | 262 ++++++++++++++++ .../v2017_05_01_preview/models/__init__.py | 12 + .../v2017_05_01_preview/models/_models.py | 154 ++++++++++ .../v2017_05_01_preview/models/_models_py3.py | 169 +++++++++++ .../operations/__init__.py | 2 + ...diagnostic_settings_category_operations.py | 2 - .../_diagnostic_settings_operations.py | 4 - .../_metric_definitions_operations.py | 12 +- .../operations/_metrics_operations.py | 1 - ...cription_diagnostic_settings_operations.py | 270 ++++++++++++++++ .../_metric_baseline_operations_async.py | 2 - .../operations/_metric_baseline_operations.py | 2 - .../_metric_namespaces_operations_async.py | 12 +- .../_metric_namespaces_operations.py | 12 +- .../_metric_definitions_operations_async.py | 12 +- .../_metrics_operations_async.py | 1 - .../_metric_definitions_operations.py | 12 +- .../operations/_metrics_operations.py | 1 - .../_action_groups_operations_async.py | 30 +- .../_metric_alerts_operations_async.py | 28 +- .../_metric_alerts_status_operations_async.py | 2 - .../operations/_action_groups_operations.py | 30 +- .../operations/_metric_alerts_operations.py | 28 +- .../_metric_alerts_status_operations.py | 2 - ..._scheduled_query_rules_operations_async.py | 29 +- .../_scheduled_query_rules_operations.py | 29 +- ...s_settings_association_operations_async.py | 29 +- ...t_diagnostics_settings_operations_async.py | 30 +- ...nostics_settings_association_operations.py | 29 +- .../_guest_diagnostics_settings_operations.py | 30 +- .../_action_groups_operations_async.py | 30 +- .../_baseline_operations_async.py | 1 - .../_metric_baseline_operations_async.py | 2 - .../operations/_action_groups_operations.py | 30 +- .../operations/_baseline_operations.py | 1 - .../operations/_metric_baseline_operations.py | 2 - .../_vm_insights_operations_async.py | 1 - .../operations/_vm_insights_operations.py | 1 - .../_action_groups_operations_async.py | 30 +- .../_baselines_operations_async.py | 12 +- .../operations/_action_groups_operations.py | 30 +- .../operations/_baselines_operations.py | 12 +- .../_action_groups_operations_async.py | 30 +- .../operations/_action_groups_operations.py | 30 +- ...e_endpoint_connections_operations_async.py | 31 +- ...private_link_resources_operations_async.py | 13 +- ...scope_operation_status_operations_async.py | 1 - ..._link_scoped_resources_operations_async.py | 31 +- .../_private_link_scopes_operations_async.py | 35 +-- ...private_endpoint_connections_operations.py | 23 +- .../_private_link_resources_operations.py | 13 +- ..._link_scope_operation_status_operations.py | 1 - ...rivate_link_scoped_resources_operations.py | 23 +- .../_private_link_scopes_operations.py | 31 +- .../monitor/v2020_01_01_preview/__init__.py | 16 + .../v2020_01_01_preview/_configuration.py | 63 ++++ .../v2020_01_01_preview/_metadata.json | 41 +++ .../v2020_01_01_preview/_monitor_client.py | 66 ++++ .../v2020_01_01_preview/aio/__init__.py | 10 + .../aio/_configuration_async.py | 59 ++++ .../aio/_monitor_client_async.py | 60 ++++ .../aio/operations_async/__init__.py | 13 + ...up_diagnostic_settings_operations_async.py | 279 +++++++++++++++++ .../v2020_01_01_preview/models/__init__.py | 28 ++ .../v2020_01_01_preview/models/_models.py | 189 ++++++++++++ .../v2020_01_01_preview/models/_models_py3.py | 209 +++++++++++++ .../operations/__init__.py | 13 + ...nt_group_diagnostic_settings_operations.py | 287 ++++++++++++++++++ .../mgmt/monitor/v2020_01_01_preview/py.typed | 1 + sdk/monitor/azure-mgmt-monitor/setup.py | 2 +- 110 files changed, 2812 insertions(+), 756 deletions(-) create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_subscription_diagnostic_settings_operations_async.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_client.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration_async.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_client_async.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations_async/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations_async/_management_group_diagnostic_settings_operations_async.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/__init__.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/py.typed 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 10f7fb847c53..603a8679aaaf 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 @@ -74,6 +74,7 @@ class MonitorClient(MultiApiClientMixin, _SDKClient): 'operations': '2015-04-01', 'scheduled_query_rules': '2018-04-16', 'service_diagnostic_settings': '2016-09-01', + 'subscription_diagnostic_settings': '2017-05-01-preview', 'tenant_activity_logs': '2015-04-01', 'vm_insights': '2018-11-27-preview', }}, @@ -126,6 +127,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 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` """ if api_version == '2015-04-01': from .v2015_04_01 import models @@ -181,6 +183,9 @@ 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 == '2020-01-01-preview': + from .v2020_01_01_preview import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property @@ -380,6 +385,19 @@ def log_profiles(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def management_group_diagnostic_settings(self): + """Instance depends on the API version: + + * 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` + """ + api_version = self._get_api_version('management_group_diagnostic_settings') + if api_version == '2020-01-01-preview': + from .v2020_01_01_preview.operations import ManagementGroupDiagnosticSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def metric_alerts(self): """Instance depends on the API version: @@ -580,6 +598,19 @@ def service_diagnostic_settings(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def subscription_diagnostic_settings(self): + """Instance depends on the API version: + + * 2017-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` + """ + api_version = self._get_api_version('subscription_diagnostic_settings') + if api_version == '2017-05-01-preview': + from .v2017_05_01_preview.operations import SubscriptionDiagnosticSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def tenant_activity_logs(self): """Instance depends on the API version: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client_async.py index ba3066bf38de..8626d6cedd7d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client_async.py @@ -74,6 +74,7 @@ class MonitorClient(MultiApiClientMixin, _SDKClient): 'operations': '2015-04-01', 'scheduled_query_rules': '2018-04-16', 'service_diagnostic_settings': '2016-09-01', + 'subscription_diagnostic_settings': '2017-05-01-preview', 'tenant_activity_logs': '2015-04-01', 'vm_insights': '2018-11-27-preview', }}, @@ -126,6 +127,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 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` """ if api_version == '2015-04-01': from ..v2015_04_01 import models @@ -181,6 +183,9 @@ 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 == '2020-01-01-preview': + from ..v2020_01_01_preview import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property @@ -380,6 +385,19 @@ def log_profiles(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def management_group_diagnostic_settings(self): + """Instance depends on the API version: + + * 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` + """ + api_version = self._get_api_version('management_group_diagnostic_settings') + if api_version == '2020-01-01-preview': + from ..v2020_01_01_preview.aio.operations_async import ManagementGroupDiagnosticSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def metric_alerts(self): """Instance depends on the API version: @@ -580,6 +598,19 @@ def service_diagnostic_settings(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def subscription_diagnostic_settings(self): + """Instance depends on the API version: + + * 2017-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` + """ + api_version = self._get_api_version('subscription_diagnostic_settings') + if api_version == '2017-05-01-preview': + from ..v2017_05_01_preview.aio.operations_async import SubscriptionDiagnosticSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def tenant_activity_logs(self): """Instance depends on the API version: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_activity_logs_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_activity_logs_operations_async.py index 546845b0715d..9c4cfb5dcfd3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_activity_logs_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_activity_logs_operations_async.py @@ -83,6 +83,10 @@ def list( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -97,15 +101,11 @@ def prepare_request(next_link=None): if select is not None: query_parameters['$select'] = self._serialize.query("select", select, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_autoscale_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_autoscale_settings_operations_async.py index d0c3611a6c78..535ebf059cc2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_autoscale_settings_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_autoscale_settings_operations_async.py @@ -61,6 +61,10 @@ def list_by_resource_group( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -73,15 +77,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -153,7 +153,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'AutoscaleSettingResource') body_content_kwargs['content'] = body_content @@ -167,7 +166,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -218,7 +216,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -272,7 +269,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -335,7 +331,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(autoscale_setting_resource, 'AutoscaleSettingResourcePatch') body_content_kwargs['content'] = body_content @@ -374,6 +369,10 @@ def list_by_subscription( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -385,15 +384,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_event_categories_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_event_categories_operations_async.py index 4b305b9f1875..216cd1628e4c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_event_categories_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_event_categories_operations_async.py @@ -60,6 +60,10 @@ def list( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -67,15 +71,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_operations_async.py index 7ab8d4a73098..c156800fc1d6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_operations_async.py @@ -67,7 +67,6 @@ async def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_tenant_activity_logs_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_tenant_activity_logs_operations_async.py index 78a23d401592..0bd0488e7ad2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_tenant_activity_logs_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations_async/_tenant_activity_logs_operations_async.py @@ -87,6 +87,10 @@ def list( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -98,15 +102,11 @@ def prepare_request(next_link=None): if select is not None: query_parameters['$select'] = self._serialize.query("select", select, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): 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 2f726256ab99..88e95258e032 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 @@ -88,6 +88,10 @@ def list( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -102,15 +106,11 @@ def prepare_request(next_link=None): if select is not None: query_parameters['$select'] = self._serialize.query("select", select, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 79d72b6266d1..b40e31f86004 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 @@ -66,6 +66,10 @@ def list_by_resource_group( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -78,15 +82,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -159,7 +159,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'AutoscaleSettingResource') body_content_kwargs['content'] = body_content @@ -173,7 +172,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -225,7 +223,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -280,7 +277,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -344,7 +340,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(autoscale_setting_resource, 'AutoscaleSettingResourcePatch') body_content_kwargs['content'] = body_content @@ -384,6 +379,10 @@ def list_by_subscription( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -395,15 +394,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 8069db565488..e0ac5d58ce86 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 @@ -65,6 +65,10 @@ def list( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -72,15 +76,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 711c35e35d89..74a60269828a 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 @@ -72,7 +72,6 @@ def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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 443ecace9907..21f7fc3e98fc 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 @@ -92,6 +92,10 @@ def list( api_version = "2015-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -103,15 +107,11 @@ def prepare_request(next_link=None): if select is not None: query_parameters['$select'] = self._serialize.query("select", select, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations_async/_service_diagnostic_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations_async/_service_diagnostic_settings_operations_async.py index 80fc84aff3be..61b12ab5914a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations_async/_service_diagnostic_settings_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations_async/_service_diagnostic_settings_operations_async.py @@ -74,7 +74,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -131,7 +130,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') body_content_kwargs['content'] = body_content 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 4d187c7eb8d0..dd51a8765b03 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 @@ -79,7 +79,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -137,7 +136,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_alert_rule_incidents_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_alert_rule_incidents_operations_async.py index 0bd6743edd6b..13a318637e7d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_alert_rule_incidents_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_alert_rule_incidents_operations_async.py @@ -84,7 +84,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -125,6 +124,10 @@ def list_by_alert_rule( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_alert_rule.metadata['url'] # type: ignore @@ -138,15 +141,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_alert_rules_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_alert_rules_operations_async.py index 40fc33a916f8..2f65424a1917 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_alert_rules_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_alert_rules_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'AlertRuleResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('AlertRuleResource', pipeline_response) @@ -150,7 +148,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -203,7 +200,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -265,7 +261,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') body_content_kwargs['content'] = body_content @@ -279,7 +274,6 @@ async def update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('AlertRuleResource', pipeline_response) @@ -312,6 +306,10 @@ def list_by_resource_group( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -324,15 +322,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -376,6 +370,10 @@ def list_by_subscription( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -387,15 +385,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_log_profiles_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_log_profiles_operations_async.py index 03f78acbcf15..7fd60ac7452d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_log_profiles_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_log_profiles_operations_async.py @@ -75,7 +75,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -124,7 +123,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -182,7 +180,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'LogProfileResource') body_content_kwargs['content'] = body_content @@ -243,7 +240,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(log_profiles_resource, 'LogProfileResourcePatch') body_content_kwargs['content'] = body_content @@ -282,6 +278,10 @@ def list( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -293,15 +293,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_metric_definitions_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_metric_definitions_operations_async.py index 980e2560f8a8..991023ab0373 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_metric_definitions_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations_async/_metric_definitions_operations_async.py @@ -69,6 +69,10 @@ def list( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -82,15 +86,11 @@ def prepare_request(next_link=None): if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): 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 e8b53116f795..d03b2ca4cd58 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 @@ -89,7 +89,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -131,6 +130,10 @@ def list_by_alert_rule( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_alert_rule.metadata['url'] # type: ignore @@ -144,15 +147,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 00c493e770f7..730f6f97d754 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'AlertRuleResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('AlertRuleResource', pipeline_response) @@ -156,7 +154,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -210,7 +207,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -273,7 +269,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') body_content_kwargs['content'] = body_content @@ -287,7 +282,6 @@ def update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('AlertRuleResource', pipeline_response) @@ -321,6 +315,10 @@ def list_by_resource_group( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -333,15 +331,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -386,6 +380,10 @@ def list_by_subscription( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -397,15 +395,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 28287bfca490..3c320b619340 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 @@ -80,7 +80,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -130,7 +129,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,7 +187,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'LogProfileResource') body_content_kwargs['content'] = body_content @@ -251,7 +248,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(log_profiles_resource, 'LogProfileResourcePatch') body_content_kwargs['content'] = body_content @@ -291,6 +287,10 @@ def list( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +302,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 648a0e20c152..16cbfd8764da 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 @@ -74,6 +74,10 @@ def list( api_version = "2016-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -87,15 +91,11 @@ def prepare_request(next_link=None): if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations_async/_metrics_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations_async/_metrics_operations_async.py index a1e43e59135a..c41220ca93b1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations_async/_metrics_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations_async/_metrics_operations_async.py @@ -81,6 +81,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -94,15 +98,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations_async/_service_diagnostic_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations_async/_service_diagnostic_settings_operations_async.py index 4a509e34389c..2d09fec91ff5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations_async/_service_diagnostic_settings_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations_async/_service_diagnostic_settings_operations_async.py @@ -75,7 +75,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -133,7 +132,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') body_content_kwargs['content'] = body_content @@ -194,7 +192,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(service_diagnostic_settings_resource, 'ServiceDiagnosticSettingsResourcePatch') body_content_kwargs['content'] = body_content 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 eb82005250b6..015dcea7cca8 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 @@ -86,6 +86,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -99,15 +103,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 f8d3eb82c5f1..2edc68dc67fb 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 @@ -80,7 +80,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -139,7 +138,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') body_content_kwargs['content'] = body_content @@ -201,7 +199,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(service_diagnostic_settings_resource, 'ServiceDiagnosticSettingsResourcePatch') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations_async/_activity_log_alerts_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations_async/_activity_log_alerts_operations_async.py index 01a945d60655..0c3d2c15308d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations_async/_activity_log_alerts_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations_async/_activity_log_alerts_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -151,7 +149,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -207,7 +204,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -267,7 +263,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertResourcePatch') body_content_kwargs['content'] = body_content @@ -306,6 +301,10 @@ def list_by_subscription_id( api_version = "2017-03-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -317,15 +316,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -373,6 +368,10 @@ def list_by_resource_group( api_version = "2017-03-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -385,15 +384,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): 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 127095519b30..e2705ac6af99 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -157,7 +155,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -214,7 +211,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -275,7 +271,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertResourcePatch') body_content_kwargs['content'] = body_content @@ -315,6 +310,10 @@ def list_by_subscription_id( api_version = "2017-03-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -326,15 +325,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -383,6 +378,10 @@ def list_by_resource_group( api_version = "2017-03-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -395,15 +394,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations_async/_action_groups_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations_async/_action_groups_operations_async.py index 976b7fee8363..5ea02ab90d46 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations_async/_action_groups_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations_async/_action_groups_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -151,7 +149,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -207,7 +204,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -266,7 +262,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -305,6 +300,10 @@ def list_by_subscription_id( api_version = "2017-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -316,15 +315,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -372,6 +367,10 @@ def list_by_resource_group( api_version = "2017-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -384,15 +383,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -464,7 +459,6 @@ async def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations_async/_activity_log_alerts_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations_async/_activity_log_alerts_operations_async.py index 5d57d7042881..28a9f0f80661 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations_async/_activity_log_alerts_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations_async/_activity_log_alerts_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -151,7 +149,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -207,7 +204,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -267,7 +263,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertPatchBody') body_content_kwargs['content'] = body_content @@ -306,6 +301,10 @@ def list_by_subscription_id( api_version = "2017-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -317,15 +316,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -373,6 +368,10 @@ def list_by_resource_group( api_version = "2017-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -385,15 +384,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): 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 3eece4fceea9..b96de78f757d 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -157,7 +155,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -214,7 +211,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -274,7 +270,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -314,6 +309,10 @@ def list_by_subscription_id( api_version = "2017-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -325,15 +324,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -382,6 +377,10 @@ def list_by_resource_group( api_version = "2017-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -394,15 +393,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -475,7 +470,6 @@ def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content 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 cc66de1cc6b2..5801b40afa61 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -157,7 +155,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -214,7 +211,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -275,7 +271,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertPatchBody') body_content_kwargs['content'] = body_content @@ -315,6 +310,10 @@ def list_by_subscription_id( api_version = "2017-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -326,15 +325,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -383,6 +378,10 @@ def list_by_resource_group( api_version = "2017-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -395,15 +394,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 49963f04cef8..44e42860e85c 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 @@ -35,7 +35,8 @@ "diagnostic_settings_category": "DiagnosticSettingsCategoryOperations", "diagnostic_settings": "DiagnosticSettingsOperations", "metric_definitions": "MetricDefinitionsOperations", - "metrics": "MetricsOperations" + "metrics": "MetricsOperations", + "subscription_diagnostic_settings": "SubscriptionDiagnosticSettingsOperations" }, "operation_mixins": { }, 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 1049403f77d2..2544cd20040f 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 @@ -22,6 +22,7 @@ from .operations import DiagnosticSettingsOperations from .operations import MetricDefinitionsOperations from .operations import MetricsOperations +from .operations import SubscriptionDiagnosticSettingsOperations from . import models @@ -36,6 +37,8 @@ class MonitorClient(object): :vartype metric_definitions: $(python-base-namespace).v2017_05_01_preview.operations.MetricDefinitionsOperations :ivar metrics: MetricsOperations operations :vartype metrics: $(python-base-namespace).v2017_05_01_preview.operations.MetricsOperations + :ivar subscription_diagnostic_settings: SubscriptionDiagnosticSettingsOperations operations + :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 str base_url: Service URL @@ -66,6 +69,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.metrics = MetricsOperations( self._client, self._config, self._serialize, self._deserialize) + self.subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) def close(self): # type: () -> None diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_client_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_client_async.py index bdf57250bac3..84b485dbb02f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_client_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_client_async.py @@ -20,6 +20,7 @@ from .operations_async import DiagnosticSettingsOperations from .operations_async import MetricDefinitionsOperations from .operations_async import MetricsOperations +from .operations_async import SubscriptionDiagnosticSettingsOperations from .. import models @@ -34,6 +35,8 @@ class MonitorClient(object): :vartype metric_definitions: $(python-base-namespace).v2017_05_01_preview.aio.operations_async.MetricDefinitionsOperations :ivar metrics: MetricsOperations operations :vartype metrics: $(python-base-namespace).v2017_05_01_preview.aio.operations_async.MetricsOperations + :ivar subscription_diagnostic_settings: SubscriptionDiagnosticSettingsOperations operations + :vartype subscription_diagnostic_settings: $(python-base-namespace).v2017_05_01_preview.aio.operations_async.SubscriptionDiagnosticSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param str base_url: Service URL @@ -63,6 +66,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.metrics = MetricsOperations( self._client, self._config, self._serialize, self._deserialize) + self.subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/__init__.py index 53c821159646..5255fab74fab 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/__init__.py @@ -10,10 +10,12 @@ from ._diagnostic_settings_operations_async import DiagnosticSettingsOperations from ._metric_definitions_operations_async import MetricDefinitionsOperations from ._metrics_operations_async import MetricsOperations +from ._subscription_diagnostic_settings_operations_async import SubscriptionDiagnosticSettingsOperations __all__ = [ 'DiagnosticSettingsCategoryOperations', 'DiagnosticSettingsOperations', 'MetricDefinitionsOperations', 'MetricsOperations', + 'SubscriptionDiagnosticSettingsOperations', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_diagnostic_settings_category_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_diagnostic_settings_category_operations_async.py index a87d1299ac9a..9239d2207e4b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_diagnostic_settings_category_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_diagnostic_settings_category_operations_async.py @@ -78,7 +78,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -130,7 +129,6 @@ async def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_diagnostic_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_diagnostic_settings_operations_async.py index 03fdbab28d73..74cab3900ac3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_diagnostic_settings_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_diagnostic_settings_operations_async.py @@ -78,7 +78,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -139,7 +138,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DiagnosticSettingsResource') body_content_kwargs['content'] = body_content @@ -198,7 +196,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -247,7 +244,6 @@ async def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_metric_definitions_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_metric_definitions_operations_async.py index 4eb76638b102..159c7d4a3957 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_metric_definitions_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_metric_definitions_operations_async.py @@ -61,6 +61,10 @@ def list( api_version = "2017-05-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -72,15 +76,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_metrics_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_metrics_operations_async.py index 63aa465e09cf..8cb313037935 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_metrics_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_metrics_operations_async.py @@ -129,7 +129,6 @@ async def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_subscription_diagnostic_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_subscription_diagnostic_settings_operations_async.py new file mode 100644 index 000000000000..18c42fffa3be --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations_async/_subscription_diagnostic_settings_operations_async.py @@ -0,0 +1,262 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionDiagnosticSettingsOperations: + """SubscriptionDiagnosticSettingsOperations 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).v2017_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 + + async def get( + self, + subscription_id: str, + name: str, + **kwargs + ) -> "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 + :return: SubscriptionDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-05-01-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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'] = 'application/json' + + 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('SubscriptionDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + async def create_or_update( + self, + subscription_id: str, + name: str, + parameters: "models.SubscriptionDiagnosticSettingsResource", + **kwargs + ) -> "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. + :type parameters: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # 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), + 'name': self._serialize.url("name", 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SubscriptionDiagnosticSettingsResource') + 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]: + 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('SubscriptionDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + 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 + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-05-01-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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] + + 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': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + async def list( + self, + subscription_id: str, + **kwargs + ) -> "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"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-05-01-preview" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + } + 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'] = 'application/json' + + 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('SubscriptionDiagnosticSettingsResourceCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py index eb00bbd4670e..c0dd979a816d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py @@ -24,6 +24,10 @@ from ._models_py3 import ProxyOnlyResource from ._models_py3 import Response from ._models_py3 import RetentionPolicy + from ._models_py3 import SubscriptionDiagnosticSettingsResource + from ._models_py3 import SubscriptionDiagnosticSettingsResourceCollection + from ._models_py3 import SubscriptionLogSettings + from ._models_py3 import SubscriptionProxyOnlyResource from ._models_py3 import TimeSeriesElement except (SyntaxError, ImportError): from ._models import DiagnosticSettingsCategoryResource # type: ignore @@ -43,6 +47,10 @@ from ._models import ProxyOnlyResource # type: ignore from ._models import Response # type: ignore from ._models import RetentionPolicy # type: ignore + from ._models import SubscriptionDiagnosticSettingsResource # type: ignore + from ._models import SubscriptionDiagnosticSettingsResourceCollection # type: ignore + from ._models import SubscriptionLogSettings # type: ignore + from ._models import SubscriptionProxyOnlyResource # type: ignore from ._models import TimeSeriesElement # type: ignore from ._monitor_client_enums import ( @@ -70,6 +78,10 @@ 'ProxyOnlyResource', 'Response', 'RetentionPolicy', + 'SubscriptionDiagnosticSettingsResource', + 'SubscriptionDiagnosticSettingsResourceCollection', + 'SubscriptionLogSettings', + 'SubscriptionProxyOnlyResource', 'TimeSeriesElement', 'AggregationType', 'CategoryType', diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py index 712e141f8f61..eec0efc4acc0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py @@ -616,6 +616,160 @@ def __init__( self.days = kwargs['days'] +class SubscriptionProxyOnlyResource(msrest.serialization.Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Location of the resource. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + + +class SubscriptionDiagnosticSettingsResource(SubscriptionProxyOnlyResource): + """The subscription diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Location of the resource. + :type location: str + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: list[~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- + integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[SubscriptionLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionDiagnosticSettingsResource, self).__init__(**kwargs) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.event_hub_name = kwargs.get('event_hub_name', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) + + +class SubscriptionDiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of subscription diagnostic settings resources. + + :param value: The collection of subscription diagnostic settings resources. + :type value: list[~$(python-base- + namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionDiagnosticSettingsResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionDiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class SubscriptionLogSettings(msrest.serialization.Model): + """Part of Subscription diagnostic setting. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Subscription Diagnostic Log category for a resource type this + setting is applied to. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionLogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.enabled = kwargs['enabled'] + + class TimeSeriesElement(msrest.serialization.Model): """A time series result type. The discriminator value is always TimeSeries in this case. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py index cd987207b765..5dba26e3628e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py @@ -689,6 +689,175 @@ def __init__( self.days = days +class SubscriptionProxyOnlyResource(msrest.serialization.Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Location of the resource. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + **kwargs + ): + super(SubscriptionProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + + +class SubscriptionDiagnosticSettingsResource(SubscriptionProxyOnlyResource): + """The subscription diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Location of the resource. + :type location: str + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: list[~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- + integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[SubscriptionLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + storage_account_id: Optional[str] = None, + service_bus_rule_id: Optional[str] = None, + event_hub_authorization_rule_id: Optional[str] = None, + event_hub_name: Optional[str] = None, + logs: Optional[List["SubscriptionLogSettings"]] = None, + workspace_id: Optional[str] = None, + **kwargs + ): + super(SubscriptionDiagnosticSettingsResource, self).__init__(location=location, **kwargs) + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.event_hub_name = event_hub_name + self.logs = logs + self.workspace_id = workspace_id + + +class SubscriptionDiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of subscription diagnostic settings resources. + + :param value: The collection of subscription diagnostic settings resources. + :type value: list[~$(python-base- + namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionDiagnosticSettingsResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["SubscriptionDiagnosticSettingsResource"]] = None, + **kwargs + ): + super(SubscriptionDiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = value + + +class SubscriptionLogSettings(msrest.serialization.Model): + """Part of Subscription diagnostic setting. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Subscription Diagnostic Log category for a resource type this + setting is applied to. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: bool, + category: Optional[str] = None, + **kwargs + ): + super(SubscriptionLogSettings, self).__init__(**kwargs) + self.category = category + self.enabled = enabled + + class TimeSeriesElement(msrest.serialization.Model): """A time series result type. The discriminator value is always TimeSeries in this case. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/__init__.py index 2116e01abcba..615dffaaf0a7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/__init__.py @@ -10,10 +10,12 @@ from ._diagnostic_settings_operations import DiagnosticSettingsOperations from ._metric_definitions_operations import MetricDefinitionsOperations from ._metrics_operations import MetricsOperations +from ._subscription_diagnostic_settings_operations import SubscriptionDiagnosticSettingsOperations __all__ = [ 'DiagnosticSettingsCategoryOperations', 'DiagnosticSettingsOperations', 'MetricDefinitionsOperations', 'MetricsOperations', + 'SubscriptionDiagnosticSettingsOperations', ] 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 a71a88cf964c..43e94358fabb 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 @@ -83,7 +83,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -136,7 +135,6 @@ def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_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 d9c8defa505c..205554a1a7df 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 @@ -83,7 +83,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -145,7 +144,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DiagnosticSettingsResource') body_content_kwargs['content'] = body_content @@ -205,7 +203,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,7 +252,6 @@ def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_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 8f878cef212b..e45209d02949 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 @@ -66,6 +66,10 @@ def list( api_version = "2017-05-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -77,15 +81,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 3ae0c17f5134..8de807f7a56a 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 @@ -134,7 +134,6 @@ def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_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 new file mode 100644 index 000000000000..69df5efa0992 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py @@ -0,0 +1,270 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionDiagnosticSettingsOperations(object): + """SubscriptionDiagnosticSettingsOperations 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).v2017_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 get( + self, + subscription_id, # type: str + name, # type: str + **kwargs # type: Any + ): + # 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 + :return: SubscriptionDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-05-01-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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'] = 'application/json' + + 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('SubscriptionDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + def create_or_update( + self, + subscription_id, # type: str + name, # type: str + parameters, # type: "models.SubscriptionDiagnosticSettingsResource" + **kwargs # type: Any + ): + # 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. + :type parameters: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionDiagnosticSettingsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # 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), + 'name': self._serialize.url("name", 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SubscriptionDiagnosticSettingsResource') + 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]: + 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('SubscriptionDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + 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 + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-05-01-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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] + + 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': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + def list( + self, + subscription_id, # type: str + **kwargs # type: Any + ): + # 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"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-05-01-preview" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + } + 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'] = 'application/json' + + 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('SubscriptionDiagnosticSettingsResourceCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations_async/_metric_baseline_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations_async/_metric_baseline_operations_async.py index 5b36e3548064..55b30f673568 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations_async/_metric_baseline_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations_async/_metric_baseline_operations_async.py @@ -109,7 +109,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -170,7 +169,6 @@ async def calculate_baseline( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(time_series_information, 'TimeSeriesInformation') body_content_kwargs['content'] = body_content 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 38b3cf012919..6d72c95a20dc 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 @@ -114,7 +114,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -176,7 +175,6 @@ def calculate_baseline( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(time_series_information, 'TimeSeriesInformation') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations_async/_metric_namespaces_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations_async/_metric_namespaces_operations_async.py index b7c67819f088..c6383dbc535a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations_async/_metric_namespaces_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations_async/_metric_namespaces_operations_async.py @@ -65,6 +65,10 @@ def list( api_version = "2017-12-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -78,15 +82,11 @@ def prepare_request(next_link=None): if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): 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 527c7d50b2ea..ac2e15fd0d60 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 @@ -70,6 +70,10 @@ def list( api_version = "2017-12-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -83,15 +87,11 @@ def prepare_request(next_link=None): if start_time is not None: query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations_async/_metric_definitions_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations_async/_metric_definitions_operations_async.py index f2610f416921..5b6b57a65489 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations_async/_metric_definitions_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations_async/_metric_definitions_operations_async.py @@ -64,6 +64,10 @@ def list( api_version = "2018-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -77,15 +81,11 @@ def prepare_request(next_link=None): if metricnamespace is not None: query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations_async/_metrics_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations_async/_metrics_operations_async.py index 2619331a75dc..f7506ae215d4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations_async/_metrics_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations_async/_metrics_operations_async.py @@ -134,7 +134,6 @@ async def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 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 189a8e7f566e..5394e02138a7 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 @@ -69,6 +69,10 @@ def list( api_version = "2018-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -82,15 +86,11 @@ def prepare_request(next_link=None): if metricnamespace is not None: query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 4ee3cdeac9ba..af27aa446a7f 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 @@ -139,7 +139,6 @@ def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_action_groups_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_action_groups_operations_async.py index 090ab5775c6d..a29a2f00f43c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_action_groups_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_action_groups_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -151,7 +149,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -207,7 +204,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -266,7 +262,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -305,6 +300,10 @@ def list_by_subscription_id( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -316,15 +315,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -372,6 +367,10 @@ def list_by_resource_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -384,15 +383,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -464,7 +459,6 @@ async def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_metric_alerts_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_metric_alerts_operations_async.py index ef784a5b3e75..99015405e48d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_metric_alerts_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_metric_alerts_operations_async.py @@ -58,6 +58,10 @@ def list_by_subscription( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -69,15 +73,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -125,6 +125,10 @@ def list_by_resource_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -137,15 +141,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -212,7 +212,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -274,7 +273,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'MetricAlertResource') body_content_kwargs['content'] = body_content @@ -340,7 +338,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'MetricAlertResourcePatch') body_content_kwargs['content'] = body_content @@ -400,7 +397,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_metric_alerts_status_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_metric_alerts_status_operations_async.py index cb697fddff3f..4af15179dae2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_metric_alerts_status_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations_async/_metric_alerts_status_operations_async.py @@ -79,7 +79,6 @@ async def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -140,7 +139,6 @@ async def list_by_name( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 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 4b66802d0a68..6731fa73b9dc 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -157,7 +155,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -214,7 +211,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -274,7 +270,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -314,6 +309,10 @@ def list_by_subscription_id( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -325,15 +324,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -382,6 +377,10 @@ def list_by_resource_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -394,15 +393,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -475,7 +470,6 @@ def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content 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 9dd3a99353e1..4f64e09fe934 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 @@ -63,6 +63,10 @@ def list_by_subscription( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -74,15 +78,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -131,6 +131,10 @@ def list_by_resource_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -143,15 +147,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -219,7 +219,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,7 +281,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'MetricAlertResource') body_content_kwargs['content'] = body_content @@ -349,7 +347,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'MetricAlertResourcePatch') body_content_kwargs['content'] = body_content @@ -410,7 +407,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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 db320c5be98d..89676ed6bca8 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 @@ -84,7 +84,6 @@ def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -146,7 +145,6 @@ def list_by_name( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations_async/_scheduled_query_rules_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations_async/_scheduled_query_rules_operations_async.py index 4f06359015b6..efeb24cda9fa 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations_async/_scheduled_query_rules_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations_async/_scheduled_query_rules_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'LogSearchRuleResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -151,7 +149,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -213,7 +210,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'LogSearchRuleResourcePatch') body_content_kwargs['content'] = body_content @@ -273,7 +269,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -309,6 +304,10 @@ def list_by_subscription( api_version = "2018-04-16" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -322,15 +321,11 @@ def prepare_request(next_link=None): if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -382,6 +377,10 @@ def list_by_resource_group( api_version = "2018-04-16" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -396,15 +395,11 @@ def prepare_request(next_link=None): if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): 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 9b9a052c444a..3a8849390880 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'LogSearchRuleResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -157,7 +155,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,7 +217,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'LogSearchRuleResourcePatch') body_content_kwargs['content'] = body_content @@ -281,7 +277,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -318,6 +313,10 @@ def list_by_subscription( api_version = "2018-04-16" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -331,15 +330,11 @@ def prepare_request(next_link=None): if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -392,6 +387,10 @@ def list_by_resource_group( api_version = "2018-04-16" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -406,15 +405,11 @@ def prepare_request(next_link=None): if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations_async/_guest_diagnostics_settings_association_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations_async/_guest_diagnostics_settings_association_operations_async.py index 800a4871fffe..788cba728deb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations_async/_guest_diagnostics_settings_association_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations_async/_guest_diagnostics_settings_association_operations_async.py @@ -86,7 +86,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(diagnostic_settings_association, 'GuestDiagnosticSettingsAssociationResource') body_content_kwargs['content'] = body_content @@ -100,7 +99,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -152,7 +150,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -208,7 +205,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -268,7 +264,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GuestDiagnosticSettingsAssociationResourcePatch') body_content_kwargs['content'] = body_content @@ -307,6 +302,10 @@ def list( api_version = "2018-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -318,15 +317,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -374,6 +369,10 @@ def list_by_resource_group( api_version = "2018-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -386,15 +385,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations_async/_guest_diagnostics_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations_async/_guest_diagnostics_settings_operations_async.py index e66048792418..dfffd09c07d0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations_async/_guest_diagnostics_settings_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations_async/_guest_diagnostics_settings_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(diagnostic_settings, 'GuestDiagnosticSettingsResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestDiagnosticSettingsResource', pipeline_response) @@ -151,7 +149,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -213,7 +210,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GuestDiagnosticSettingsPatchResource') body_content_kwargs['content'] = body_content @@ -227,7 +223,6 @@ async def update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestDiagnosticSettingsResource', pipeline_response) @@ -278,7 +273,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -310,6 +304,10 @@ def list( api_version = "2018-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -321,15 +319,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -377,6 +371,10 @@ def list_by_resource_group( api_version = "2018-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -389,15 +387,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): 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 ca51c9811a8f..9b78d5c763fe 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 @@ -91,7 +91,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(diagnostic_settings_association, 'GuestDiagnosticSettingsAssociationResource') body_content_kwargs['content'] = body_content @@ -105,7 +104,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -158,7 +156,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -215,7 +212,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -276,7 +272,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GuestDiagnosticSettingsAssociationResourcePatch') body_content_kwargs['content'] = body_content @@ -316,6 +311,10 @@ def list( api_version = "2018-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -327,15 +326,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -384,6 +379,10 @@ def list_by_resource_group( api_version = "2018-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -396,15 +395,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 698890fa7a0f..d951e4a6c414 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(diagnostic_settings, 'GuestDiagnosticSettingsResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestDiagnosticSettingsResource', pipeline_response) @@ -157,7 +155,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,7 +217,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GuestDiagnosticSettingsPatchResource') body_content_kwargs['content'] = body_content @@ -234,7 +230,6 @@ def update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestDiagnosticSettingsResource', pipeline_response) @@ -286,7 +281,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -319,6 +313,10 @@ def list( api_version = "2018-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -330,15 +328,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -387,6 +381,10 @@ def list_by_resource_group( api_version = "2018-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -399,15 +397,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_action_groups_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_action_groups_operations_async.py index bf9cea406dbb..bd5eca32589d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_action_groups_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_action_groups_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -151,7 +149,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -207,7 +204,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -266,7 +262,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -305,6 +300,10 @@ def list_by_subscription_id( api_version = "2018-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -316,15 +315,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -372,6 +367,10 @@ def list_by_resource_group( api_version = "2018-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -384,15 +383,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -464,7 +459,6 @@ async def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_baseline_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_baseline_operations_async.py index 2c521e7c4ca9..20abdb9f418b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_baseline_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_baseline_operations_async.py @@ -121,7 +121,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_metric_baseline_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_metric_baseline_operations_async.py index 920b35d247b4..1bc77eb81035 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_metric_baseline_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations_async/_metric_baseline_operations_async.py @@ -120,7 +120,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -181,7 +180,6 @@ async def calculate_baseline( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(time_series_information, 'TimeSeriesInformation') body_content_kwargs['content'] = body_content 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 9c226edce714..642d091182c9 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -157,7 +155,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -214,7 +211,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -274,7 +270,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -314,6 +309,10 @@ def list_by_subscription_id( api_version = "2018-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -325,15 +324,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -382,6 +377,10 @@ def list_by_resource_group( api_version = "2018-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -394,15 +393,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -475,7 +470,6 @@ def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content 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 93c20fda662d..f85a15c418ba 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 @@ -126,7 +126,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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 fe1f3b950f40..c9439511b10f 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 @@ -125,7 +125,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,7 +186,6 @@ def calculate_baseline( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(time_series_information, 'TimeSeriesInformation') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations_async/_vm_insights_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations_async/_vm_insights_operations_async.py index 2e7dbbbd96ad..57cd1a5ca418 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations_async/_vm_insights_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations_async/_vm_insights_operations_async.py @@ -75,7 +75,6 @@ async def get_onboarding_status( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 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 3dfca063b20b..09b143463ff8 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 @@ -80,7 +80,6 @@ def get_onboarding_status( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations_async/_action_groups_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations_async/_action_groups_operations_async.py index f1b204ad1802..20b3738a518a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations_async/_action_groups_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations_async/_action_groups_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -151,7 +149,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -207,7 +204,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -266,7 +262,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -305,6 +300,10 @@ def list_by_subscription_id( api_version = "2019-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -316,15 +315,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -372,6 +367,10 @@ def list_by_resource_group( api_version = "2019-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -384,15 +383,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -464,7 +459,6 @@ async def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations_async/_baselines_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations_async/_baselines_operations_async.py index 85fcf01a50b4..6ab151e33568 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations_async/_baselines_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations_async/_baselines_operations_async.py @@ -96,6 +96,10 @@ def list( api_version = "2019-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -123,15 +127,11 @@ def prepare_request(next_link=None): query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'str') 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): 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 1e5486def040..76e8e61ad9eb 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -157,7 +155,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -214,7 +211,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -274,7 +270,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -314,6 +309,10 @@ def list_by_subscription_id( api_version = "2019-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -325,15 +324,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -382,6 +377,10 @@ def list_by_resource_group( api_version = "2019-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -394,15 +393,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -475,7 +470,6 @@ def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content 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 4cf7882d5ff0..7d6039c9d2eb 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 @@ -101,6 +101,10 @@ def list( api_version = "2019-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -128,15 +132,11 @@ def prepare_request(next_link=None): query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'str') 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations_async/_action_groups_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations_async/_action_groups_operations_async.py index fe5353de618c..bfd97a003292 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations_async/_action_groups_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations_async/_action_groups_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -99,7 +98,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -151,7 +149,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -207,7 +204,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -266,7 +262,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -305,6 +300,10 @@ def list_by_subscription_id( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -316,15 +315,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -372,6 +367,10 @@ def list_by_resource_group( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -384,15 +383,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -464,7 +459,6 @@ async def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content 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 eaaf8b65c6f6..48aa919d7ca3 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 @@ -90,7 +90,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group, 'ActionGroupResource') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -157,7 +155,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -214,7 +211,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -274,7 +270,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') body_content_kwargs['content'] = body_content @@ -314,6 +309,10 @@ def list_by_subscription_id( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore @@ -325,15 +324,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -382,6 +377,10 @@ def list_by_resource_group( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -394,15 +393,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -475,7 +470,6 @@ def enable_receiver( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(enable_request, 'EnableRequest') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_endpoint_connections_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_endpoint_connections_operations_async.py index 2f46ba3d4005..1e0b9d9693c6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_endpoint_connections_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_endpoint_connections_operations_async.py @@ -86,7 +86,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -110,8 +109,8 @@ async def _create_or_update_initial( private_endpoint_connection_name: str, parameters: "models.PrivateEndpointConnection", **kwargs - ) -> "models.PrivateEndpointConnection": - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + ) -> Optional["models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-17-preview" @@ -136,7 +135,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') body_content_kwargs['content'] = body_content @@ -166,7 +164,7 @@ async def begin_create_or_update( private_endpoint_connection_name: str, parameters: "models.PrivateEndpointConnection", **kwargs - ) -> "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. @@ -183,8 +181,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -257,7 +255,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -277,7 +274,7 @@ async def begin_delete( scope_name: str, private_endpoint_connection_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. @@ -292,8 +289,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -356,6 +353,10 @@ def list_by_private_link_scope( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore @@ -369,15 +370,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_resources_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_resources_operations_async.py index d391ed980c2c..16a2129b128a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_resources_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_resources_operations_async.py @@ -64,6 +64,10 @@ def list_by_private_link_scope( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore @@ -77,15 +81,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -155,7 +155,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scope_operation_status_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scope_operation_status_operations_async.py index 13ad723c1472..c34bf20f60e9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scope_operation_status_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scope_operation_status_operations_async.py @@ -80,7 +80,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scoped_resources_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scoped_resources_operations_async.py index 008a6c2682dd..659f706fc30a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scoped_resources_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scoped_resources_operations_async.py @@ -86,7 +86,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -110,8 +109,8 @@ async def _create_or_update_initial( name: str, parameters: "models.ScopedResource", **kwargs - ) -> "models.ScopedResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.ScopedResource"] + ) -> Optional["models.ScopedResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ScopedResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-17-preview" @@ -136,7 +135,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedResource') body_content_kwargs['content'] = body_content @@ -169,7 +167,7 @@ async def begin_create_or_update( name: str, parameters: "models.ScopedResource", **kwargs - ) -> "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. @@ -186,8 +184,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: ScopedResource, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2019_10_17.models.ScopedResource + :return: An instance of AsyncLROPoller that returns either ScopedResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~$(python-base-namespace).v2019_10_17.models.ScopedResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -260,7 +258,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -280,7 +277,7 @@ async def begin_delete( scope_name: str, name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. @@ -295,8 +292,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -359,6 +356,10 @@ def list_by_private_link_scope( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore @@ -372,15 +373,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scopes_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scopes_operations_async.py index 7a29cfc8f276..30f8e0934330 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scopes_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations_async/_private_link_scopes_operations_async.py @@ -60,6 +60,10 @@ def list( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -71,15 +75,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -126,6 +126,10 @@ def list_by_resource_group( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -138,15 +142,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -200,7 +200,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request 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 @@ -219,7 +218,7 @@ async def begin_delete( resource_group_name: str, scope_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a Azure Monitor PrivateLinkScope. :param resource_group_name: The name of the resource group. @@ -232,8 +231,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -311,7 +310,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request 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 @@ -374,7 +372,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_monitor_private_link_scope_payload, 'AzureMonitorPrivateLinkScope') body_content_kwargs['content'] = body_content @@ -387,7 +384,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('AzureMonitorPrivateLinkScope', pipeline_response) @@ -446,7 +442,6 @@ async def update_tags( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(private_link_scope_tags, 'TagsResource') body_content_kwargs['content'] = body_content 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 df618206c2b1..973b74415f14 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 @@ -91,7 +91,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,8 +115,8 @@ def _create_or_update_initial( parameters, # type: "models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + # type: (...) -> Optional["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-17-preview" @@ -142,7 +141,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') body_content_kwargs['content'] = body_content @@ -173,7 +171,7 @@ def begin_create_or_update( parameters, # type: "models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> LROPoller + # 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. @@ -265,7 +263,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,7 +283,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. @@ -366,6 +363,10 @@ def list_by_private_link_scope( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore @@ -379,15 +380,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 c1dbec515c6c..3cba8aa64872 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 @@ -69,6 +69,10 @@ def list_by_private_link_scope( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore @@ -82,15 +86,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -161,7 +161,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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 e514981b159e..7a24c222e6f6 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 @@ -85,7 +85,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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 140d8c183ef8..48915618d0a9 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 @@ -91,7 +91,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,8 +115,8 @@ def _create_or_update_initial( parameters, # type: "models.ScopedResource" **kwargs # type: Any ): - # type: (...) -> "models.ScopedResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.ScopedResource"] + # type: (...) -> Optional["models.ScopedResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ScopedResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-17-preview" @@ -142,7 +141,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedResource') body_content_kwargs['content'] = body_content @@ -176,7 +174,7 @@ def begin_create_or_update( parameters, # type: "models.ScopedResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # 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. @@ -268,7 +266,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -289,7 +286,7 @@ def begin_delete( name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a private endpoint connection with a given name. :param resource_group_name: The name of the resource group. @@ -369,6 +366,10 @@ def list_by_private_link_scope( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore @@ -382,15 +383,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): 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 c444be7cab8e..cb9099705172 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 @@ -65,6 +65,10 @@ def list( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -76,15 +80,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -132,6 +132,10 @@ def list_by_resource_group( api_version = "2019-10-17-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -144,15 +148,11 @@ def prepare_request(next_link=None): 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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -207,7 +207,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -227,7 +226,7 @@ def begin_delete( scope_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a Azure Monitor PrivateLinkScope. :param resource_group_name: The name of the resource group. @@ -320,7 +319,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -384,7 +382,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(azure_monitor_private_link_scope_payload, 'AzureMonitorPrivateLinkScope') body_content_kwargs['content'] = body_content @@ -397,7 +394,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('AzureMonitorPrivateLinkScope', pipeline_response) @@ -457,7 +453,6 @@ def update_tags( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(private_link_scope_tags, 'TagsResource') body_content_kwargs['content'] = body_content diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/__init__.py new file mode 100644 index 000000000000..aa2ae096d6f8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_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 + patch_sdk() +except ImportError: + pass 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 new file mode 100644 index 000000000000..4b323569a397 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.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. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +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 + """ + + def __init__( + self, + credential, # type: "TokenCredential" + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(MonitorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2020-01-01-preview" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.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.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_01_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json new file mode 100644 index 000000000000..09c3b6824ab5 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json @@ -0,0 +1,41 @@ +{ + "chosen_version": "2020-01-01-preview", + "total_api_version_list": ["2020-01-01-preview"], + "client": { + "name": "MonitorClient", + "filename": "_monitor_client", + "description": "Monitor Management Client." + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } + }, + "constant": { + }, + "call": "credential" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] + }, + "operation_groups": { + "management_group_diagnostic_settings": "ManagementGroupDiagnosticSettingsOperations" + }, + "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_01_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_client.py new file mode 100644 index 000000000000..1751c514be10 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_client.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 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 ManagementGroupDiagnosticSettingsOperations +from . import models + + +class MonitorClient(object): + """Monitor Management Client. + + :ivar management_group_diagnostic_settings: ManagementGroupDiagnosticSettingsOperations operations + :vartype management_group_diagnostic_settings: $(python-base-namespace).v2020_01_01_preview.operations.ManagementGroupDiagnosticSettingsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :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. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + 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._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.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( + 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_01_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/__init__.py new file mode 100644 index 000000000000..94deb09d251b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_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_async import MonitorClient +__all__ = ['MonitorClient'] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration_async.py new file mode 100644 index 000000000000..50a4c9f0e71a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration_async.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +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 + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(MonitorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2020-01-01-preview" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.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.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_01_01_preview/aio/_monitor_client_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_client_async.py new file mode 100644 index 000000000000..09f44135e3d3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_client_async.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from 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_async import MonitorClientConfiguration +from .operations_async import ManagementGroupDiagnosticSettingsOperations +from .. import models + + +class MonitorClient(object): + """Monitor Management Client. + + :ivar management_group_diagnostic_settings: ManagementGroupDiagnosticSettingsOperations operations + :vartype management_group_diagnostic_settings: $(python-base-namespace).v2020_01_01_preview.aio.operations_async.ManagementGroupDiagnosticSettingsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorClientConfiguration(credential, **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.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( + 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_01_01_preview/aio/operations_async/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations_async/__init__.py new file mode 100644 index 000000000000..1d01e8b41b8a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations_async/__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 ._management_group_diagnostic_settings_operations_async import ManagementGroupDiagnosticSettingsOperations + +__all__ = [ + 'ManagementGroupDiagnosticSettingsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations_async/_management_group_diagnostic_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations_async/_management_group_diagnostic_settings_operations_async.py new file mode 100644 index 000000000000..3fbede75aabd --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations_async/_management_group_diagnostic_settings_operations_async.py @@ -0,0 +1,279 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagementGroupDiagnosticSettingsOperations: + """ManagementGroupDiagnosticSettingsOperations 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_01_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 + + async def get( + self, + management_group_id: str, + name: str, + **kwargs + ) -> "models.ManagementGroupDiagnosticSettingsResource": + """Gets the active management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_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 + :return: ManagementGroupDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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'] = 'application/json' + + 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('ManagementGroupDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + async def create_or_update( + self, + management_group_id: str, + name: str, + parameters: "models.ManagementGroupDiagnosticSettingsResource", + **kwargs + ) -> "models.ManagementGroupDiagnosticSettingsResource": + """Creates or updates management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroupDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagementGroupDiagnosticSettingsResource') + 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]: + 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('ManagementGroupDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + async def delete( + self, + management_group_id: str, + name: str, + **kwargs + ) -> None: + """Deletes existing management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_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 + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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] + + 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': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + def list( + self, + management_group_id: str, + **kwargs + ) -> AsyncIterable["models.ManagementGroupDiagnosticSettingsResourceCollection"]: + """Gets the active management group diagnostic settings list for the specified management group. + + :param management_group_id: The management group id. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagementGroupDiagnosticSettingsResourceCollection or the result of cls(response) + :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"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + } + 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('ManagementGroupDiagnosticSettingsResourceCollection', 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.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.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/__init__.py new file mode 100644 index 000000000000..b5d8c1b8e24d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/__init__.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ErrorResponse + from ._models_py3 import ManagementGroupDiagnosticSettingsResource + from ._models_py3 import ManagementGroupDiagnosticSettingsResourceCollection + from ._models_py3 import ManagementGroupLogSettings + from ._models_py3 import ManagementGroupProxyOnlyResource +except (SyntaxError, ImportError): + from ._models import ErrorResponse # type: ignore + from ._models import ManagementGroupDiagnosticSettingsResource # type: ignore + from ._models import ManagementGroupDiagnosticSettingsResourceCollection # type: ignore + from ._models import ManagementGroupLogSettings # type: ignore + from ._models import ManagementGroupProxyOnlyResource # type: ignore + +__all__ = [ + 'ErrorResponse', + 'ManagementGroupDiagnosticSettingsResource', + 'ManagementGroupDiagnosticSettingsResourceCollection', + 'ManagementGroupLogSettings', + 'ManagementGroupProxyOnlyResource', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py new file mode 100644 index 000000000000..f0ecc19cab41 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py @@ -0,0 +1,189 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 ErrorResponse(msrest.serialization.Model): + """Describes the format of Error response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ManagementGroupProxyOnlyResource(msrest.serialization.Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Location of the resource. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + + +class ManagementGroupDiagnosticSettingsResource(ManagementGroupProxyOnlyResource): + """The management group diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Location of the resource. + :type location: str + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: list[~$(python-base- + namespace).v2020_01_01_preview.models.ManagementGroupLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- + integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[ManagementGroupLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupDiagnosticSettingsResource, self).__init__(**kwargs) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.event_hub_name = kwargs.get('event_hub_name', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) + + +class ManagementGroupDiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of management group diagnostic settings resources. + + :param value: The collection of management group diagnostic settings resources. + :type value: list[~$(python-base- + namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementGroupDiagnosticSettingsResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupDiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ManagementGroupLogSettings(msrest.serialization.Model): + """Part of Management Group diagnostic setting. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Required. Name of a Management Group Diagnostic Log category for a resource + type this setting is applied to. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'category': {'required': True}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupLogSettings, self).__init__(**kwargs) + self.category = kwargs['category'] + self.enabled = kwargs['enabled'] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..47525123592b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py @@ -0,0 +1,209 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 List, Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ErrorResponse(msrest.serialization.Model): + """Describes the format of Error response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ManagementGroupProxyOnlyResource(msrest.serialization.Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Location of the resource. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + **kwargs + ): + super(ManagementGroupProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + + +class ManagementGroupDiagnosticSettingsResource(ManagementGroupProxyOnlyResource): + """The management group diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Location of the resource. + :type location: str + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: list[~$(python-base- + namespace).v2020_01_01_preview.models.ManagementGroupLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- + integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[ManagementGroupLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + storage_account_id: Optional[str] = None, + service_bus_rule_id: Optional[str] = None, + event_hub_authorization_rule_id: Optional[str] = None, + event_hub_name: Optional[str] = None, + logs: Optional[List["ManagementGroupLogSettings"]] = None, + workspace_id: Optional[str] = None, + **kwargs + ): + super(ManagementGroupDiagnosticSettingsResource, self).__init__(location=location, **kwargs) + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.event_hub_name = event_hub_name + self.logs = logs + self.workspace_id = workspace_id + + +class ManagementGroupDiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of management group diagnostic settings resources. + + :param value: The collection of management group diagnostic settings resources. + :type value: list[~$(python-base- + namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementGroupDiagnosticSettingsResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["ManagementGroupDiagnosticSettingsResource"]] = None, + **kwargs + ): + super(ManagementGroupDiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = value + + +class ManagementGroupLogSettings(msrest.serialization.Model): + """Part of Management Group diagnostic setting. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Required. Name of a Management Group Diagnostic Log category for a resource + type this setting is applied to. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'category': {'required': True}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + category: str, + enabled: bool, + **kwargs + ): + super(ManagementGroupLogSettings, self).__init__(**kwargs) + self.category = category + self.enabled = enabled diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/__init__.py new file mode 100644 index 000000000000..c619e7568800 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_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 ._management_group_diagnostic_settings_operations import ManagementGroupDiagnosticSettingsOperations + +__all__ = [ + 'ManagementGroupDiagnosticSettingsOperations', +] 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 new file mode 100644 index 000000000000..7894423ce286 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py @@ -0,0 +1,287 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ManagementGroupDiagnosticSettingsOperations(object): + """ManagementGroupDiagnosticSettingsOperations 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_01_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 get( + self, + management_group_id, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementGroupDiagnosticSettingsResource" + """Gets the active management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_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 + :return: ManagementGroupDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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'] = 'application/json' + + 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('ManagementGroupDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + def create_or_update( + self, + management_group_id, # type: str + name, # type: str + parameters, # type: "models.ManagementGroupDiagnosticSettingsResource" + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementGroupDiagnosticSettingsResource" + """Creates or updates management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroupDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupDiagnosticSettingsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagementGroupDiagnosticSettingsResource') + 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]: + 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('ManagementGroupDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + def delete( + self, + management_group_id, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes existing management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_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 + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", 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] + + 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': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + + def list( + self, + management_group_id, # type: str + **kwargs # type: Any + ): + # 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. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagementGroupDiagnosticSettingsResourceCollection or the result of cls(response) + :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"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + } + 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('ManagementGroupDiagnosticSettingsResourceCollection', 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.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.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/py.typed b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_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/setup.py b/sdk/monitor/azure-mgmt-monitor/setup.py index d7d9e9ad486f..87dc0be08557 100644 --- a/sdk/monitor/azure-mgmt-monitor/setup.py +++ b/sdk/monitor/azure-mgmt-monitor/setup.py @@ -36,7 +36,7 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py') +with open(os.path.join(package_folder_path, 'version.py') if os.path.exists(os.path.join(package_folder_path, 'version.py')) else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',