diff --git a/sdk/monitor/azure-mgmt-monitor/_meta.json b/sdk/monitor/azure-mgmt-monitor/_meta.json index f5d16436e4bc9..77346f7de02a1 100644 --- a/sdk/monitor/azure-mgmt-monitor/_meta.json +++ b/sdk/monitor/azure-mgmt-monitor/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.13.0", "@autorest/modelerfour@4.19.3" ], - "commit": "8174b2fc60e288a9d7fcdff5f9414e43a6ad5989", + "commit": "263d3035f12a3d6c7311e24b670cd4125d9ed131", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/monitor/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/monitor/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/monitor/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py index d810d1e177d4b..5d524a1a56b89 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py @@ -11,10 +11,11 @@ from typing import TYPE_CHECKING +from msrest import Deserializer, Serializer + from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from msrest import Deserializer, Serializer from ._configuration import MonitorManagementClientConfiguration @@ -65,7 +66,6 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): 'alert_rule_incidents': '2016-03-01', 'alert_rules': '2016-03-01', 'autoscale_settings': '2015-04-01', - 'baseline': '2018-09-01', 'baselines': '2019-03-01', 'data_collection_endpoints': '2021-04-01', 'data_collection_rule_associations': '2021-04-01', @@ -79,7 +79,7 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): 'management_group_diagnostic_settings': '2021-05-01-preview', 'metric_alerts': '2018-03-01', 'metric_alerts_status': '2018-03-01', - 'metric_baseline': '2018-09-01', + 'metric_baseline': '2017-11-01-preview', 'metric_definitions': '2018-01-01', 'metric_namespaces': '2017-12-01-preview', 'metrics': '2018-01-01', @@ -338,19 +338,6 @@ def autoscale_settings(self): raise ValueError("API version {} does not have operation group 'autoscale_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def baseline(self): - """Instance depends on the API version: - - * 2018-09-01: :class:`BaselineOperations` - """ - api_version = self._get_api_version('baseline') - if api_version == '2018-09-01': - from .v2018_09_01.operations import BaselineOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'baseline'".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def baselines(self): """Instance depends on the API version: @@ -549,13 +536,10 @@ def metric_baseline(self): """Instance depends on the API version: * 2017-11-01-preview: :class:`MetricBaselineOperations` - * 2018-09-01: :class:`MetricBaselineOperations` """ api_version = self._get_api_version('metric_baseline') if api_version == '2017-11-01-preview': from .v2017_11_01_preview.operations import MetricBaselineOperations as OperationClass - elif api_version == '2018-09-01': - from .v2018_09_01.operations import MetricBaselineOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'metric_baseline'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py index 4baa61a8055b1..b559ed966eacf 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py @@ -11,10 +11,11 @@ from typing import Any, Optional, TYPE_CHECKING +from msrest import Deserializer, Serializer + from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from msrest import Deserializer, Serializer from ._configuration import MonitorManagementClientConfiguration @@ -64,7 +65,6 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): 'alert_rule_incidents': '2016-03-01', 'alert_rules': '2016-03-01', 'autoscale_settings': '2015-04-01', - 'baseline': '2018-09-01', 'baselines': '2019-03-01', 'data_collection_endpoints': '2021-04-01', 'data_collection_rule_associations': '2021-04-01', @@ -78,7 +78,7 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): 'management_group_diagnostic_settings': '2021-05-01-preview', 'metric_alerts': '2018-03-01', 'metric_alerts_status': '2018-03-01', - 'metric_baseline': '2018-09-01', + 'metric_baseline': '2017-11-01-preview', 'metric_definitions': '2018-01-01', 'metric_namespaces': '2017-12-01-preview', 'metrics': '2018-01-01', @@ -337,19 +337,6 @@ def autoscale_settings(self): raise ValueError("API version {} does not have operation group 'autoscale_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def baseline(self): - """Instance depends on the API version: - - * 2018-09-01: :class:`BaselineOperations` - """ - api_version = self._get_api_version('baseline') - if api_version == '2018-09-01': - from ..v2018_09_01.aio.operations import BaselineOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'baseline'".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def baselines(self): """Instance depends on the API version: @@ -548,13 +535,10 @@ def metric_baseline(self): """Instance depends on the API version: * 2017-11-01-preview: :class:`MetricBaselineOperations` - * 2018-09-01: :class:`MetricBaselineOperations` """ api_version = self._get_api_version('metric_baseline') if api_version == '2017-11-01-preview': from ..v2017_11_01_preview.aio.operations import MetricBaselineOperations as OperationClass - elif api_version == '2018-09-01': - from ..v2018_09_01.aio.operations import MetricBaselineOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'metric_baseline'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py index 9def65086344c..156de7bce87c0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py @@ -8,12 +8,12 @@ from .v2015_07_01.models import * from .v2016_03_01.models import * from .v2016_09_01.models import * +from .v2017_11_01_preview.models import * from .v2017_12_01_preview.models import * from .v2018_01_01.models import * from .v2018_03_01.models import * from .v2018_04_16.models import * from .v2018_06_01_preview.models import * -from .v2018_09_01.models import * from .v2018_11_27_preview.models import * from .v2019_03_01.models import * from .v2019_10_17.models import * diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py index e1f58c99be3f1..b152f1a01ba71 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json index 3399fadde8828..b271c6f03d5ce 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py index de9d3cc08044b..837544b230134 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -43,7 +44,7 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str """ @@ -71,7 +72,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py index 34bea0f7b2022..fe42fc99d8d77 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_management_client.py index 1859b81d454f4..8906b5efd4820 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -44,7 +45,7 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py index 6ebd670f23bfe..06afcd10d3d8b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -76,14 +74,20 @@ def list( *authorization*\ , *claims*\ , *correlationId*\ , *description*\ , *eventDataId*\ , *eventName*\ , *eventTimestamp*\ , *httpRequest*\ , *level*\ , *operationId*\ , *operationName*\ , *properties*\ , *resourceGroupName*\ , *resourceProviderName*\ , - *resourceId*\ , *status*\ , *submissionTimestamp*\ , *subStatus*\ , *subscriptionId*. + *resourceId*\ , *status*\ , *submissionTimestamp*\ , *subStatus*\ , *subscriptionId*. Default + value is None. :type select: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventDataCollection or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.EventDataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventDataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -94,6 +98,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, select=select, template_url=self.list.metadata['url'], @@ -105,6 +110,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, select=select, template_url=next_link, @@ -124,7 +130,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -138,4 +148,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_alert_rules_operations.py index 0090b24ecd122..a34d2788a3c6e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_alert_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_alert_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -62,6 +61,9 @@ async def create_or_update( :type rule_name: str :param parameters: The parameters of the rule to create or update. :type parameters: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource @@ -73,6 +75,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AlertRuleResource') @@ -81,6 +84,7 @@ async def create_or_update( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +92,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,11 +115,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -123,6 +131,9 @@ async def delete( :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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 @@ -134,17 +145,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -155,7 +173,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace_async @@ -171,6 +189,9 @@ async def get( :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource @@ -182,17 +203,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -207,7 +235,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace_async @@ -227,6 +255,9 @@ async def update( :type rule_name: str :param alert_rules_resource: Parameters supplied to the operation. :type alert_rules_resource: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResourcePatch + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource @@ -238,6 +269,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') @@ -246,6 +278,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -253,7 +286,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -272,7 +309,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -285,6 +322,9 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) @@ -292,6 +332,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +345,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -313,6 +356,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -330,7 +374,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,7 +392,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules"} # type: ignore @distributed_trace def list_by_subscription( @@ -353,6 +401,9 @@ def list_by_subscription( ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: """List the classic metric alert rules within a subscription. + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) @@ -360,6 +411,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +423,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -379,6 +433,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,7 +451,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,4 +469,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py index 19844d7ade469..b37fcb6b93a72 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -56,6 +55,9 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AutoscaleSettingResourceCollection or the result of cls(response) @@ -63,6 +65,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +78,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -84,6 +89,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,7 +107,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,7 +125,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings"} # type: ignore @distributed_trace_async async def create_or_update( @@ -133,6 +143,9 @@ async def create_or_update( :type autoscale_setting_name: str :param parameters: Parameters supplied to the operation. :type parameters: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AutoscaleSettingResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource @@ -144,6 +157,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AutoscaleSettingResource') @@ -152,6 +166,7 @@ async def create_or_update( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -159,7 +174,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -178,11 +197,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, autoscale_setting_name: str, @@ -194,6 +213,9 @@ async def delete( :type resource_group_name: str :param autoscale_setting_name: The autoscale setting name. :type autoscale_setting_name: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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 @@ -205,17 +227,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -226,7 +255,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace_async @@ -242,6 +271,9 @@ async def get( :type resource_group_name: str :param autoscale_setting_name: The autoscale setting name. :type autoscale_setting_name: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AutoscaleSettingResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource @@ -253,17 +285,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -278,7 +317,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace_async @@ -299,6 +338,9 @@ async def update( :param autoscale_setting_resource: Parameters supplied to the operation. :type autoscale_setting_resource: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourcePatch + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AutoscaleSettingResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource @@ -310,6 +352,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(autoscale_setting_resource, 'AutoscaleSettingResourcePatch') @@ -318,6 +361,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -325,7 +369,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -340,7 +388,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace @@ -350,6 +398,9 @@ def list_by_subscription( ) -> AsyncIterable["_models.AutoscaleSettingResourceCollection"]: """Lists the autoscale settings for a subscription. + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AutoscaleSettingResourceCollection or the result of cls(response) @@ -357,6 +408,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -367,6 +420,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -376,6 +430,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -393,7 +448,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,4 +466,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py index 16baeea9aeca2..c10d3fc31c68e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -55,6 +53,9 @@ def list( Service.:code:`
`The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventCategoryCollection or the result of cls(response) @@ -62,6 +63,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.EventCategoryCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventCategoryCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -71,6 +74,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -79,6 +83,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -96,7 +101,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,4 +119,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Insights/eventcategories'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Insights/eventcategories"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py index 2a7b6d9a147a8..267f99e87f3ae 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -51,6 +50,9 @@ async def list( ) -> "_models.OperationListResult": """Lists all of the available operations from Microsoft.Insights provider. + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.OperationListResult @@ -62,14 +64,21 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -83,5 +92,5 @@ async def list( return deserialized - list.metadata = {'url': '/providers/Microsoft.Insights/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Insights/operations"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py index e9a9c1f5aab28..ae6a2514ef906 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -74,21 +72,27 @@ def list( api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq ':code:``'.:code:`
`\ **NOTE**\ : No other syntax is - allowed. + allowed. Default value is None. :type filter: str :param select: Used to fetch events with only the given properties.:code:`
`The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*\ , *claims*\ , *correlationId*\ , *description*\ , *eventDataId*\ , *eventName*\ , *eventTimestamp*\ , *httpRequest*\ , *level*\ , *operationId*\ , *operationName*\ , *properties*\ , *resourceGroupName*\ , *resourceProviderName*\ , - *resourceId*\ , *status*\ , *submissionTimestamp*\ , *subStatus*\ , *subscriptionId*. + *resourceId*\ , *status*\ , *submissionTimestamp*\ , *subStatus*\ , *subscriptionId*. Default + value is None. :type select: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventDataCollection or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.EventDataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventDataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -98,6 +102,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, filter=filter, select=select, template_url=self.list.metadata['url'], @@ -108,6 +113,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, filter=filter, select=select, template_url=next_link, @@ -127,7 +133,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -141,4 +151,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Insights/eventtypes/management/values'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Insights/eventtypes/management/values"} # type: ignore 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 d84be1161790d..c9d007faa7d6c 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,32 +33,33 @@ def build_list_request( select: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2015-04-01" + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -114,14 +115,20 @@ def list( *authorization*\ , *claims*\ , *correlationId*\ , *description*\ , *eventDataId*\ , *eventName*\ , *eventTimestamp*\ , *httpRequest*\ , *level*\ , *operationId*\ , *operationName*\ , *properties*\ , *resourceGroupName*\ , *resourceProviderName*\ , - *resourceId*\ , *status*\ , *submissionTimestamp*\ , *subStatus*\ , *subscriptionId*. + *resourceId*\ , *status*\ , *submissionTimestamp*\ , *subStatus*\ , *subscriptionId*. Default + value is None. :type select: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventDataCollection or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.EventDataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventDataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -132,6 +139,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, select=select, template_url=self.list.metadata['url'], @@ -143,6 +151,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, select=select, template_url=next_link, @@ -162,7 +171,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -176,4 +189,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_alert_rules_operations.py index 1a2dc61a2fa46..7266f7e508d5c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_alert_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_alert_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2014-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2014-04-01" + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2014-04-01" + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2014-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2014-04-01" + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2014-04-01" + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -286,6 +290,9 @@ def create_or_update( :type rule_name: str :param parameters: The parameters of the rule to create or update. :type parameters: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource @@ -297,6 +304,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AlertRuleResource') @@ -305,6 +313,7 @@ def create_or_update( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -312,7 +321,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -331,11 +344,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -347,6 +360,9 @@ def delete( :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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 @@ -358,17 +374,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -379,7 +402,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -395,6 +418,9 @@ def get( :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource @@ -406,17 +432,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +464,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -451,6 +484,9 @@ def update( :type rule_name: str :param alert_rules_resource: Parameters supplied to the operation. :type alert_rules_resource: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResourcePatch + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource @@ -462,6 +498,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') @@ -470,6 +507,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -477,7 +515,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,7 +538,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -509,6 +551,9 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) @@ -516,6 +561,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -527,6 +574,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -537,6 +585,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -554,7 +603,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -568,7 +621,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules"} # type: ignore @distributed_trace def list_by_subscription( @@ -577,6 +630,9 @@ def list_by_subscription( ) -> Iterable["_models.AlertRuleResourceCollection"]: """List the classic metric alert rules within a subscription. + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) @@ -584,6 +640,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -594,6 +652,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -603,6 +662,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -620,7 +680,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -634,4 +698,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules"} # type: ignore 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 eefbcb61faac3..417046a2c7d81 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-04-01" + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -69,35 +70,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -110,31 +111,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-04-01" + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -145,31 +147,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-04-01" + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,35 +186,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -222,29 +225,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-04-01" + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +284,9 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AutoscaleSettingResourceCollection or the result of cls(response) @@ -287,6 +294,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -298,6 +307,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -308,6 +318,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -325,7 +336,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -339,7 +354,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings"} # type: ignore @distributed_trace def create_or_update( @@ -357,6 +372,9 @@ def create_or_update( :type autoscale_setting_name: str :param parameters: Parameters supplied to the operation. :type parameters: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AutoscaleSettingResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource @@ -368,6 +386,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AutoscaleSettingResource') @@ -376,6 +395,7 @@ def create_or_update( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -383,7 +403,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -402,11 +426,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, autoscale_setting_name: str, @@ -418,6 +442,9 @@ def delete( :type resource_group_name: str :param autoscale_setting_name: The autoscale setting name. :type autoscale_setting_name: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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 @@ -429,17 +456,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -450,7 +484,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace @@ -466,6 +500,9 @@ def get( :type resource_group_name: str :param autoscale_setting_name: The autoscale setting name. :type autoscale_setting_name: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AutoscaleSettingResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource @@ -477,17 +514,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -502,7 +546,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace @@ -523,6 +567,9 @@ def update( :param autoscale_setting_resource: Parameters supplied to the operation. :type autoscale_setting_resource: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourcePatch + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AutoscaleSettingResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResource @@ -534,6 +581,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(autoscale_setting_resource, 'AutoscaleSettingResourcePatch') @@ -542,6 +590,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -549,7 +598,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -564,7 +617,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace @@ -574,6 +627,9 @@ def list_by_subscription( ) -> Iterable["_models.AutoscaleSettingResourceCollection"]: """Lists the autoscale settings for a subscription. + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AutoscaleSettingResourceCollection or the result of cls(response) @@ -581,6 +637,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -591,6 +649,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -600,6 +659,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -617,7 +677,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -631,4 +695,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings"} # type: ignore 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 2a56b97cd36d5..e9d858d7ff8aa 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2015-04-01" + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Insights/eventcategories') + _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/eventcategories") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -81,6 +82,9 @@ def list( Service.:code:`
`The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventCategoryCollection or the result of cls(response) @@ -88,6 +92,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.EventCategoryCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventCategoryCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -97,6 +103,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -105,6 +112,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -122,7 +130,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,4 +148,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Insights/eventcategories'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Insights/eventcategories"} # type: ignore 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 becc93fb69e68..17e3f524292d0 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -28,24 +28,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2015-04-01" + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Insights/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,6 +79,9 @@ def list( ) -> "_models.OperationListResult": """Lists all of the available operations from Microsoft.Insights provider. + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_04_01.models.OperationListResult @@ -89,14 +93,21 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,5 +121,5 @@ def list( return deserialized - list.metadata = {'url': '/providers/Microsoft.Insights/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Insights/operations"} # type: ignore 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 7d141717dc2a8..2fed8392364d6 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -32,28 +32,29 @@ def build_list_request( select: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2015-04-01" + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Insights/eventtypes/management/values') + _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/eventtypes/management/values") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,21 +108,27 @@ def list( api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq ':code:``'.:code:`
`\ **NOTE**\ : No other syntax is - allowed. + allowed. Default value is None. :type filter: str :param select: Used to fetch events with only the given properties.:code:`
`The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*\ , *claims*\ , *correlationId*\ , *description*\ , *eventDataId*\ , *eventName*\ , *eventTimestamp*\ , *httpRequest*\ , *level*\ , *operationId*\ , *operationName*\ , *properties*\ , *resourceGroupName*\ , *resourceProviderName*\ , - *resourceId*\ , *status*\ , *submissionTimestamp*\ , *subStatus*\ , *subscriptionId*. + *resourceId*\ , *status*\ , *submissionTimestamp*\ , *subStatus*\ , *subscriptionId*. Default + value is None. :type select: str + :keyword api_version: Api Version. Default value is "2015-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventDataCollection or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.EventDataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventDataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -131,6 +138,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, filter=filter, select=select, template_url=self.list.metadata['url'], @@ -141,6 +149,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, filter=filter, select=select, template_url=next_link, @@ -160,7 +169,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,4 +187,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Insights/eventtypes/management/values'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Insights/eventtypes/management/values"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py index e1f58c99be3f1..b152f1a01ba71 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json index d78934a876797..b25ebe0578796 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_management_client.py index 3e6ca5d03b382..f50e0fca36068 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -38,7 +39,7 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str """ @@ -64,7 +65,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py index 34bea0f7b2022..fe42fc99d8d77 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_management_client.py index 022345195ceec..96bae6b386dfb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -38,7 +39,7 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_alert_rules_operations.py index ab9addf709176..dcd5f71338194 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_alert_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_alert_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -62,6 +61,9 @@ async def create_or_update( :type rule_name: str :param parameters: The parameters of the rule to create or update. :type parameters: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource @@ -73,6 +75,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AlertRuleResource') @@ -81,6 +84,7 @@ async def create_or_update( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +92,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,11 +115,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -123,6 +131,9 @@ async def delete( :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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 @@ -134,17 +145,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -155,7 +173,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace_async @@ -171,6 +189,9 @@ async def get( :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource @@ -182,17 +203,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -207,7 +235,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace_async @@ -227,6 +255,9 @@ async def update( :type rule_name: str :param alert_rules_resource: Parameters supplied to the operation. :type alert_rules_resource: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResourcePatch + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource @@ -238,6 +269,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') @@ -246,6 +278,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -253,7 +286,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -272,7 +309,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -285,6 +322,9 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) @@ -292,6 +332,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_07_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +345,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -313,6 +356,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -330,7 +374,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,7 +392,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules"} # type: ignore @distributed_trace def list_by_subscription( @@ -353,6 +401,9 @@ def list_by_subscription( ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: """List the classic metric alert rules within a subscription. + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) @@ -360,6 +411,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_07_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +423,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -379,6 +433,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,7 +451,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,4 +469,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_metric_definitions_operations.py index 77529014142aa..b28da9cffe160 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_metric_definitions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -62,8 +60,11 @@ def list( definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% Processor Time'.:code:`
`Multiple metrics can be retrieved by joining together *'name eq :code:``'* clauses separated by *or* logical operators.:code:`
`\ **NOTE**\ : No - other syntax is allowed. + other syntax is allowed. Default value is None. :type filter: str + :keyword api_version: Api Version. Default value is "2015-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricDefinitionCollection or the result of cls(response) @@ -71,6 +72,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_07_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -81,6 +84,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -91,6 +95,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -109,7 +114,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -123,4 +132,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_operations.py index 53bc049c9ba63..c29dcdfdeff62 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -51,6 +50,9 @@ async def list( ) -> "_models.OperationListResult": """Lists all of the available operations from Microsoft.Insights provider. + :keyword api_version: Api Version. Default value is "2015-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.OperationListResult @@ -62,14 +64,21 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-07-01") # type: str + request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,5 +93,5 @@ async def list( return deserialized - list.metadata = {'url': '/providers/Microsoft.Insights/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Insights/operations"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py index 314d1cc687682..db653b769099c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -54,6 +53,9 @@ async def get( :param resource_uri: The identifier of the resource. :type resource_uri: str + :keyword api_version: Api Version. Default value is "2015-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceDiagnosticSettingsResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource @@ -65,15 +67,22 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-07-01") # type: str + request = build_get_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,7 +97,7 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore @distributed_trace_async @@ -105,6 +114,9 @@ async def create_or_update( :param parameters: Parameters supplied to the operation. :type parameters: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource + :keyword api_version: Api Version. Default value is "2015-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceDiagnosticSettingsResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource @@ -116,12 +128,14 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') request = build_create_or_update_request( resource_uri=resource_uri, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -129,7 +143,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -143,5 +161,5 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_alert_rules_operations.py index c342da7320f65..0f956bed23fec 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_alert_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_alert_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2014-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2014-04-01" + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2014-04-01" + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2014-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2014-04-01" + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2014-04-01" + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -286,6 +290,9 @@ def create_or_update( :type rule_name: str :param parameters: The parameters of the rule to create or update. :type parameters: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource @@ -297,6 +304,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AlertRuleResource') @@ -305,6 +313,7 @@ def create_or_update( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -312,7 +321,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -331,11 +344,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -347,6 +360,9 @@ def delete( :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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 @@ -358,17 +374,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -379,7 +402,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -395,6 +418,9 @@ def get( :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource @@ -406,17 +432,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +464,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -451,6 +484,9 @@ def update( :type rule_name: str :param alert_rules_resource: Parameters supplied to the operation. :type alert_rules_resource: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResourcePatch + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AlertRuleResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource @@ -462,6 +498,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2014-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') @@ -470,6 +507,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -477,7 +515,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,7 +538,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -509,6 +551,9 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) @@ -516,6 +561,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_07_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -527,6 +574,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -537,6 +585,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -554,7 +603,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -568,7 +621,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules"} # type: ignore @distributed_trace def list_by_subscription( @@ -577,6 +630,9 @@ def list_by_subscription( ) -> Iterable["_models.AlertRuleResourceCollection"]: """List the classic metric alert rules within a subscription. + :keyword api_version: Api Version. Default value is "2014-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) @@ -584,6 +640,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_07_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2014-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -594,6 +652,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -603,6 +662,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -620,7 +680,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -634,4 +698,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_metric_definitions_operations.py index 7d7162b172aab..280cae20ff877 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_metric_definitions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2015-07-01" + api_version = kwargs.pop('api_version', "2015-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,8 +99,11 @@ def list( definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% Processor Time'.:code:`
`Multiple metrics can be retrieved by joining together *'name eq :code:``'* clauses separated by *or* logical operators.:code:`
`\ **NOTE**\ : No - other syntax is allowed. + other syntax is allowed. Default value is None. :type filter: str + :keyword api_version: Api Version. Default value is "2015-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricDefinitionCollection or the result of cls(response) @@ -107,6 +111,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_07_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -117,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -127,6 +134,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -145,7 +153,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,4 +171,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_operations.py index 40d3bd1ce1b58..87f8f89c70865 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -28,24 +28,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2015-07-01" + api_version = kwargs.pop('api_version', "2015-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Insights/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,6 +79,9 @@ def list( ) -> "_models.OperationListResult": """Lists all of the available operations from Microsoft.Insights provider. + :keyword api_version: Api Version. Default value is "2015-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.OperationListResult @@ -89,14 +93,21 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-07-01") # type: str + request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,5 +122,5 @@ def list( return deserialized - list.metadata = {'url': '/providers/Microsoft.Insights/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Insights/operations"} # type: ignore 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 d7ac22592e1bc..94b078fef39c5 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,29 +30,30 @@ def build_get_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-07-01" + api_version = kwargs.pop('api_version', "2015-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,33 +65,33 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,6 +129,9 @@ def get( :param resource_uri: The identifier of the resource. :type resource_uri: str + :keyword api_version: Api Version. Default value is "2015-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceDiagnosticSettingsResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource @@ -139,15 +143,22 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-07-01") # type: str + request = build_get_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -162,7 +173,7 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore @distributed_trace @@ -179,6 +190,9 @@ def create_or_update( :param parameters: Parameters supplied to the operation. :type parameters: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource + :keyword api_version: Api Version. Default value is "2015-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceDiagnosticSettingsResource, or the result of cls(response) :rtype: ~$(python-base-namespace).v2015_07_01.models.ServiceDiagnosticSettingsResource @@ -190,12 +204,14 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') request = build_create_or_update_request( resource_uri=resource_uri, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -203,7 +219,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -217,5 +237,5 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py index 3c5148998b74d..e63c63a28c97d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2016-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-03-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json index 8b98756e89571..0b1363b1cf1f8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py index 9c79236030cbe..ce770e135ff70 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -38,8 +39,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -64,7 +68,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py index 71d775201fb97..77ff113d679f5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2016-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-03-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_management_client.py index acb5d78732548..f4eed9caaa2af 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -39,8 +40,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py index 898e4940c3f2f..d44156c346df8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,18 +72,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, incident_name=incident_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}"} # type: ignore @distributed_trace @@ -121,6 +127,8 @@ def list_by_alert_rule( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.IncidentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -133,6 +141,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_alert_rule.metadata['url'], ) request = _convert_request(request) @@ -144,6 +153,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -161,7 +171,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,4 +188,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_alert_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents'} # type: ignore + list_by_alert_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py index 5e191eff2dc5c..36122d5bcc8b3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AlertRuleResource') @@ -81,6 +81,7 @@ async def create_or_update( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,11 +112,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -134,17 +139,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -155,7 +167,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace_async @@ -182,17 +194,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -207,7 +226,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace_async @@ -238,6 +257,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') @@ -246,6 +266,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -253,7 +274,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -272,7 +297,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -292,6 +317,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +330,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -313,6 +341,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -330,7 +359,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,7 +377,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules"} # type: ignore @distributed_trace def list_by_subscription( @@ -360,6 +393,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +405,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -379,6 +415,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,7 +433,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,4 +451,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py index 6247251a07ecf..83a3211e020bc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -47,7 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, log_profile_name: str, **kwargs: Any @@ -67,16 +66,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_delete_request( log_profile_name=log_profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -86,7 +92,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}"} # type: ignore @distributed_trace_async @@ -110,16 +116,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_get_request( log_profile_name=log_profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -134,7 +147,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}"} # type: ignore @distributed_trace_async @@ -161,6 +174,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'LogProfileResource') @@ -168,6 +182,7 @@ async def create_or_update( request = build_create_or_update_request( log_profile_name=log_profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -175,7 +190,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -189,7 +208,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}"} # type: ignore @distributed_trace_async @@ -217,6 +236,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(log_profiles_resource, 'LogProfileResourcePatch') @@ -224,6 +244,7 @@ async def update( request = build_update_request( subscription_id=self._config.subscription_id, log_profile_name=log_profile_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -231,7 +252,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -246,7 +271,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}"} # type: ignore @distributed_trace @@ -263,6 +288,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.LogProfileCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -273,6 +300,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -282,6 +310,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -299,7 +328,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -312,4 +345,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py index f198e2f4c7b63..e7e7e81a88ada 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -62,7 +60,7 @@ def list( definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% Processor Time'.:code:`
`Multiple metrics can be retrieved by joining together *'name eq :code:``'* clauses separated by *or* logical operators.:code:`
`\ **NOTE**\ : No - other syntax is allowed. + other syntax is allowed. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricDefinitionCollection or the result of @@ -71,6 +69,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_03_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -81,6 +81,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -91,6 +92,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -109,7 +111,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -123,4 +129,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metricDefinitions"} # type: ignore 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 cc3a151814d48..d86c3ca3ca99b 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), @@ -44,21 +45,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -69,31 +70,32 @@ def build_list_by_alert_rule_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,18 +148,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, incident_name=incident_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,7 +181,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}"} # type: ignore @distributed_trace @@ -194,6 +203,8 @@ def list_by_alert_rule( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.IncidentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -206,6 +217,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_alert_rule.metadata['url'], ) request = _convert_request(request) @@ -217,6 +229,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -234,7 +247,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,4 +264,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_alert_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents'} # type: ignore + list_by_alert_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents"} # type: ignore 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 49c3be62dbb5e..78549d90d6da4 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -297,6 +301,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AlertRuleResource') @@ -305,6 +310,7 @@ def create_or_update( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -312,7 +318,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -331,11 +341,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -358,17 +368,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -379,7 +396,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -406,17 +423,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +455,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -462,6 +486,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') @@ -470,6 +495,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -477,7 +503,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,7 +526,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"} # type: ignore @distributed_trace @@ -516,6 +546,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -527,6 +559,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -537,6 +570,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -554,7 +588,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -568,7 +606,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules"} # type: ignore @distributed_trace def list_by_subscription( @@ -584,6 +622,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.AlertRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -594,6 +634,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -603,6 +644,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -620,7 +662,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -634,4 +680,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules"} # type: ignore 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 24b2cb6ff2ae6..55832907b61f9 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,24 +32,25 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}") # pylint: disable=line-too-long path_format_arguments = { "logProfileName": _SERIALIZER.url("log_profile_name", log_profile_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, + url=_url, + params=_query_parameters, **kwargs ) @@ -59,30 +60,31 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}") # pylint: disable=line-too-long path_format_arguments = { "logProfileName": _SERIALIZER.url("log_profile_name", log_profile_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -95,34 +97,34 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}") # pylint: disable=line-too-long path_format_arguments = { "logProfileName": _SERIALIZER.url("log_profile_name", log_profile_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -137,34 +139,34 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "logProfileName": _SERIALIZER.url("log_profile_name", log_profile_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -175,29 +177,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,7 +227,7 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, log_profile_name: str, **kwargs: Any @@ -244,16 +247,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_delete_request( log_profile_name=log_profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -263,7 +273,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}"} # type: ignore @distributed_trace @@ -287,16 +297,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + request = build_get_request( log_profile_name=log_profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -311,7 +328,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}"} # type: ignore @distributed_trace @@ -338,6 +355,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'LogProfileResource') @@ -345,6 +363,7 @@ def create_or_update( request = build_create_or_update_request( log_profile_name=log_profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -352,7 +371,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -366,7 +389,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}"} # type: ignore @distributed_trace @@ -394,6 +417,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(log_profiles_resource, 'LogProfileResourcePatch') @@ -401,6 +425,7 @@ def update( request = build_update_request( subscription_id=self._config.subscription_id, log_profile_name=log_profile_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -408,7 +433,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -423,7 +452,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}"} # type: ignore @distributed_trace @@ -440,6 +469,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.LogProfileCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogProfileCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -450,6 +481,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -459,6 +491,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -476,7 +509,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -489,4 +526,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles"} # type: ignore 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 0ff17e7e0de09..44fae0e431e1e 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-01" + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/metricDefinitions') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/metricDefinitions") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,7 +99,7 @@ def list( definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% Processor Time'.:code:`
`Multiple metrics can be retrieved by joining together *'name eq :code:``'* clauses separated by *or* logical operators.:code:`
`\ **NOTE**\ : No - other syntax is allowed. + other syntax is allowed. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricDefinitionCollection or the result of @@ -107,6 +108,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_03_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -117,6 +120,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -127,6 +131,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -145,7 +150,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,4 +168,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metricDefinitions"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py index f5100df22e0eb..3924ba7ecc21c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-09-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2016-09-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json index 056ea76a8642f..8445b275583e9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_management_client.py index fc61134de6fc1..86c8a4166980f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: $(python-base-namespace).v2016_09_01.operations.ServiceDiagnosticSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -54,7 +58,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py index e050303155784..459d9633f5bd7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-09-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2016-09-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_management_client.py index fc77dcd16de01..a588a74b3ee31 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: $(python-base-namespace).v2016_09_01.aio.operations.ServiceDiagnosticSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py index f608928956038..3741304eb62fb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -74,7 +72,7 @@ def list( duration'PT1M'.:code:`
`:code:`
`\ **NOTE**\ : When a metrics query comes in with multiple metrics, but with no aggregation types defined, the service will pick the Primary aggregation type of the first metrics to be used as the default aggregation type for all the - metrics. + metrics. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricCollection or the result of cls(response) @@ -82,6 +80,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2016_09_01.models.MetricCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -92,6 +92,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -102,6 +103,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -120,7 +122,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -134,4 +140,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metrics"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py index 39efc93f4a2c2..6a869d8987de9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -66,15 +65,22 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-09-01") # type: str + request = build_get_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,7 +95,7 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore @distributed_trace_async @@ -118,12 +124,14 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') request = build_create_or_update_request( resource_uri=resource_uri, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -131,7 +139,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -145,7 +157,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore @distributed_trace_async @@ -174,12 +186,14 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(service_diagnostic_settings_resource, 'ServiceDiagnosticSettingsResourcePatch') request = build_update_request( resource_uri=resource_uri, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -187,7 +201,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -202,5 +220,5 @@ async def update( return deserialized - update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore 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 1f7abb6576c38..7d6e742bcc6c4 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-09-01" + api_version = kwargs.pop('api_version', "2016-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/metrics') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/metrics") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,7 +111,7 @@ def list( duration'PT1M'.:code:`
`:code:`
`\ **NOTE**\ : When a metrics query comes in with multiple metrics, but with no aggregation types defined, the service will pick the Primary aggregation type of the first metrics to be used as the default aggregation type for all the - metrics. + metrics. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricCollection or the result of cls(response) @@ -118,6 +119,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2016_09_01.models.MetricCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -128,6 +131,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -138,6 +142,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -156,7 +161,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -170,4 +179,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metrics"} # type: ignore 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 9c1f8097d6e35..132b0444c0c8f 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,29 +30,30 @@ def build_get_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-09-01" + api_version = kwargs.pop('api_version', "2016-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,33 +65,33 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-09-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-09-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -104,33 +105,33 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-09-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-09-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -180,15 +181,22 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-09-01") # type: str + request = build_get_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,7 +211,7 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore @distributed_trace @@ -232,12 +240,14 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') request = build_create_or_update_request( resource_uri=resource_uri, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -245,7 +255,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -259,7 +273,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore @distributed_trace @@ -288,12 +302,14 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(service_diagnostic_settings_resource, 'ServiceDiagnosticSettingsResourcePatch') request = build_update_request( resource_uri=resource_uri, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -301,7 +317,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -316,5 +336,5 @@ def update( return deserialized - update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'} # type: ignore + update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py index 23b544c587c23..f80855d964080 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2017-03-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-03-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json index 877e90f7a5f9d..0c766a2666c3d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py index 2fff9a7767ce4..8a83f35a6b0bd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-03-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -54,7 +58,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py index 79386b6bd3508..93dde4d32098b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2017-03-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-03-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_management_client.py index ffe1322a32a49..1bb68186ccd19 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-03-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py index d040201f8eea2..248b52c15d821 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -74,6 +73,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') @@ -82,6 +82,7 @@ async def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -89,7 +90,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -108,7 +113,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace_async @@ -135,17 +140,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -160,11 +172,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, activity_log_alert_name: str, @@ -187,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -208,7 +227,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace_async @@ -240,6 +259,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertResourcePatch') @@ -248,6 +268,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -255,7 +276,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,7 +295,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -287,6 +312,8 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -297,6 +324,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -306,6 +334,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -323,7 +352,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -337,7 +370,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -356,6 +389,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -367,6 +402,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -377,6 +413,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -394,7 +431,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -408,4 +449,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts"} # type: ignore 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 70048fb8511ed..4d5a12e73397f 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( activity_log_alert_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-01-preview" + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_delete_request( activity_log_alert_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-01-preview" + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -189,29 +191,30 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-01-preview" + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -221,30 +224,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-01-preview" + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -298,6 +302,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') @@ -306,6 +311,7 @@ def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -313,7 +319,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -332,7 +342,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -359,17 +369,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -384,11 +401,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, activity_log_alert_name: str, @@ -411,17 +428,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -432,7 +456,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -464,6 +488,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertResourcePatch') @@ -472,6 +497,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -479,7 +505,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -494,7 +524,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -511,6 +541,8 @@ def list_by_subscription_id( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -521,6 +553,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -530,6 +563,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -547,7 +581,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -561,7 +599,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -580,6 +618,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -591,6 +631,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -601,6 +642,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -618,7 +660,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -632,4 +678,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py index 1723a0c2143e4..8c6bdb7fc024a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2017-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-04-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json index 93b8dd8db8766..52b385c18990f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py index 2a3235194c0ff..5208218adf51b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -33,8 +34,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -57,7 +61,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py index 9d93745c9a825..fd655e4fe02ef 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2017-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-04-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_management_client.py index e74e70f31cff8..ee73f8b67beef 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -34,8 +35,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py index 6d47fbde7702f..e6b8d02d98ec3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -81,6 +81,7 @@ async def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,7 +112,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -134,17 +139,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,11 +171,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -186,17 +198,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -207,7 +226,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -237,6 +256,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -245,6 +265,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -252,7 +273,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,7 +292,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -283,6 +308,8 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_04_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -293,6 +320,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -302,6 +330,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -319,7 +348,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -333,7 +366,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -351,6 +384,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_04_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -362,6 +397,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -372,6 +408,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -389,7 +426,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -403,10 +444,10 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace_async - async def enable_receiver( + async def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -433,6 +474,7 @@ async def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -441,6 +483,7 @@ async def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -448,7 +491,11 @@ async def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -459,5 +506,5 @@ async def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py index 80e66fb77d490..446acee340639 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') @@ -81,6 +81,7 @@ async def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,7 +112,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace_async @@ -134,17 +139,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,11 +171,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, activity_log_alert_name: str, @@ -186,17 +198,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -207,7 +226,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace_async @@ -239,6 +258,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertPatchBody') @@ -247,6 +267,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -254,7 +275,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -269,7 +294,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -286,6 +311,8 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -296,6 +323,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -305,6 +333,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -322,7 +351,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -336,7 +369,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -355,6 +388,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -366,6 +401,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -376,6 +412,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -393,7 +430,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,4 +448,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts"} # type: ignore 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 2b3f1dc57e9fb..e5ada1ee94129 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-04-01" + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-04-01" + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -189,29 +191,30 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-04-01" + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -221,30 +224,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-04-01" + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -258,35 +262,35 @@ def build_enable_receiver_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -341,6 +345,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -349,6 +354,7 @@ def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -356,7 +362,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -375,7 +385,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -402,17 +412,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -427,11 +444,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -454,17 +471,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -475,7 +499,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -505,6 +529,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -513,6 +538,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -520,7 +546,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -535,7 +565,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -551,6 +581,8 @@ def list_by_subscription_id( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_04_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -561,6 +593,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -570,6 +603,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -587,7 +621,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,7 +639,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -619,6 +657,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_04_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -630,6 +670,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -640,6 +681,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -657,7 +699,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -671,10 +717,10 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace - def enable_receiver( + def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -701,6 +747,7 @@ def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -709,6 +756,7 @@ def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -716,7 +764,11 @@ def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -727,5 +779,5 @@ def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore 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 d465ef64e4bdd..5e91810daa6f5 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( activity_log_alert_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-04-01" + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_delete_request( activity_log_alert_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-04-01" + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -189,29 +191,30 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-04-01" + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -221,30 +224,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-04-01" + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -297,6 +301,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') @@ -305,6 +310,7 @@ def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -312,7 +318,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -331,7 +341,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -358,17 +368,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -383,11 +400,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, activity_log_alert_name: str, @@ -410,17 +427,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -431,7 +455,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -463,6 +487,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertPatchBody') @@ -471,6 +496,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -478,7 +504,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -493,7 +523,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -510,6 +540,8 @@ def list_by_subscription_id( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -520,6 +552,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -529,6 +562,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -546,7 +580,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -560,7 +598,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -579,6 +617,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -590,6 +630,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -600,6 +641,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -617,7 +659,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -631,4 +677,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py index adb04d3afc9e0..f0b9640c35c91 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2017-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-05-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) 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 0f3d571414fae..02a0a3071b815 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 @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py index 747a5873d2a38..6ba113cdc845d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -42,8 +43,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -69,7 +73,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py index ac5e4fab2ecee..2ffbaa6983ff4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2017-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-05-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_management_client.py index e5c199e8f47c5..69aeaf51fcdbf 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -42,8 +43,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py index cafab6b4b88bc..3b1098c846013 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -68,16 +67,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,7 +98,7 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}"} # type: ignore @distributed_trace_async @@ -117,15 +123,22 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -140,5 +153,5 @@ async def list( return deserialized - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py index f57b4c4dd0a91..e53dc7b5cc371 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -68,16 +67,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,7 +98,7 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async @@ -123,6 +129,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DiagnosticSettingsResource') @@ -130,6 +137,7 @@ async def create_or_update( request = build_create_or_update_request( resource_uri=resource_uri, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -137,7 +145,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -152,11 +164,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, name: str, @@ -179,16 +191,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -199,7 +218,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async @@ -224,15 +243,22 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,5 +273,5 @@ async def list( return deserialized - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py index ca5ce67eba088..0ab349cae874b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_05_01_preview.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -73,6 +73,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -82,6 +83,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -99,7 +101,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,4 +119,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metricDefinitions"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py index 7e03d11992493..66f232150beb2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -64,21 +63,22 @@ async def list( :param resource_uri: The identifier of the resource. :type resource_uri: str :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. + 'startDateTime_ISO/endDateTime_ISO'. Default value is None. :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. + :param interval: The interval (i.e. timegrain) of the query. Default value is None. :type interval: ~datetime.timedelta - :param metric: The name of the metric to retrieve. + :param metric: The name of the metric to retrieve. Default value is None. :type metric: str - :param aggregation: The list of aggregation types (comma separated) to retrieve. + :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value + is None. :type aggregation: str :param top: The maximum number of records to retrieve. Valid only if $filter is specified. - Defaults to 10. + Defaults to 10. Default value is None. :type top: int :param orderby: The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. - Examples: sum asc. + Examples: sum asc. Default value is None. :type orderby: str :param filter: The **$filter** is used to reduce the set of metric data returned.:code:`
`Example::code:`
`Metric contains metadata A, B and C.:code:`
`- @@ -88,10 +88,10 @@ async def list( logical or operator cannot separate two different metadata names.:code:`
`- Return all time series where A = a1, B = b1 and C = c1::code:`
`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘\ *’ and C eq ‘*\ ’**. + B eq ‘\ *’ and C eq ‘*\ ’**. Default value is None. :type filter: str :param result_type: Reduces the set of data collected. The syntax allowed depends on the - operation. See the operation's description for details. + operation. See the operation's description for details. Default value is None. :type result_type: str or ~$(python-base-namespace).v2017_05_01_preview.models.ResultType :keyword callable cls: A custom type or function that will be passed the direct response :return: Response, or the result of cls(response) @@ -104,9 +104,12 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_list_request( resource_uri=resource_uri, + api_version=api_version, timespan=timespan, interval=interval, metric=metric, @@ -120,7 +123,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -135,5 +142,5 @@ async def list( return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metrics"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py index 4b0c9ac8f0f1c..9a5165d6223ac 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -66,16 +65,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -90,7 +96,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async @@ -119,6 +125,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SubscriptionDiagnosticSettingsResource') @@ -126,6 +133,7 @@ async def create_or_update( request = build_create_or_update_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -133,7 +141,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -148,11 +160,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, name: str, **kwargs: Any @@ -172,16 +184,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -192,7 +211,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async @@ -214,15 +233,22 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -237,5 +263,5 @@ async def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings'} # type: ignore + 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/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 6a6819601998b..6ca170db820d9 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,30 +30,31 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -62,29 +63,30 @@ def build_list_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -134,16 +136,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -158,7 +167,7 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}"} # type: ignore @distributed_trace @@ -183,15 +192,22 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -206,5 +222,5 @@ def list( return deserialized - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories"} # type: ignore 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 537aa0d67b939..57279b872a43f 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -67,34 +68,34 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-05-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -106,30 +107,31 @@ def build_delete_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -138,29 +140,30 @@ def build_list_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -210,16 +213,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -234,7 +244,7 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -265,6 +275,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DiagnosticSettingsResource') @@ -272,6 +283,7 @@ def create_or_update( request = build_create_or_update_request( resource_uri=resource_uri, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -279,7 +291,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -294,11 +310,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, name: str, @@ -321,16 +337,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -341,7 +364,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -366,15 +389,22 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -389,5 +419,5 @@ def list( return deserialized - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings"} # type: ignore 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 c836a6bd1441f..b0029ce35007a 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,29 +30,30 @@ def build_list_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/metricDefinitions') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/metricDefinitions") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -95,6 +96,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_05_01_preview.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -105,6 +108,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -114,6 +118,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -131,7 +136,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -145,4 +154,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metricDefinitions"} # type: ignore 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 6fe2455241b8d..2c44466e30f9e 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,45 +39,46 @@ def build_list_request( result_type: Optional[Union[str, "_models.ResultType"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/metrics') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/metrics") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if timespan is not None: - query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') + _query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') if interval is not None: - query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') + _query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') if metric is not None: - query_parameters['metric'] = _SERIALIZER.query("metric", metric, 'str') + _query_parameters['metric'] = _SERIALIZER.query("metric", metric, 'str') if aggregation is not None: - query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') + _query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') if orderby is not None: - query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if result_type is not None: - query_parameters['resultType'] = _SERIALIZER.query("result_type", result_type, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['resultType'] = _SERIALIZER.query("result_type", result_type, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -122,21 +123,22 @@ def list( :param resource_uri: The identifier of the resource. :type resource_uri: str :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. + 'startDateTime_ISO/endDateTime_ISO'. Default value is None. :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. + :param interval: The interval (i.e. timegrain) of the query. Default value is None. :type interval: ~datetime.timedelta - :param metric: The name of the metric to retrieve. + :param metric: The name of the metric to retrieve. Default value is None. :type metric: str - :param aggregation: The list of aggregation types (comma separated) to retrieve. + :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value + is None. :type aggregation: str :param top: The maximum number of records to retrieve. Valid only if $filter is specified. - Defaults to 10. + Defaults to 10. Default value is None. :type top: int :param orderby: The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. - Examples: sum asc. + Examples: sum asc. Default value is None. :type orderby: str :param filter: The **$filter** is used to reduce the set of metric data returned.:code:`
`Example::code:`
`Metric contains metadata A, B and C.:code:`
`- @@ -146,10 +148,10 @@ def list( logical or operator cannot separate two different metadata names.:code:`
`- Return all time series where A = a1, B = b1 and C = c1::code:`
`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘\ *’ and C eq ‘*\ ’**. + B eq ‘\ *’ and C eq ‘*\ ’**. Default value is None. :type filter: str :param result_type: Reduces the set of data collected. The syntax allowed depends on the - operation. See the operation's description for details. + operation. See the operation's description for details. Default value is None. :type result_type: str or ~$(python-base-namespace).v2017_05_01_preview.models.ResultType :keyword callable cls: A custom type or function that will be passed the direct response :return: Response, or the result of cls(response) @@ -162,9 +164,12 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_list_request( resource_uri=resource_uri, + api_version=api_version, timespan=timespan, interval=interval, metric=metric, @@ -178,7 +183,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -193,5 +202,5 @@ def list( return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metrics"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py index 89e7e61db03f5..679b8bf6456ca 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -67,34 +68,34 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-05-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -106,30 +107,31 @@ def build_delete_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -138,29 +140,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-05-01-preview" + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -208,16 +211,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -232,7 +242,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -261,6 +271,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SubscriptionDiagnosticSettingsResource') @@ -268,6 +279,7 @@ def create_or_update( request = build_create_or_update_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -275,7 +287,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -290,11 +306,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, name: str, **kwargs: Any @@ -314,16 +330,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -334,7 +357,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -356,15 +379,22 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-05-01-preview") # type: str + request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -379,5 +409,5 @@ def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings'} # type: ignore + 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/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py deleted file mode 100644 index ec9090a57df09..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._monitor_management_client import MonitorManagementClient -from ._version import VERSION - -__version__ = VERSION -__all__ = ['MonitorManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py deleted file mode 100644 index 2f232283b850a..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py +++ /dev/null @@ -1,62 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. - - 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: "TokenCredential", - **kwargs: Any - ) -> None: - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.api_version = "2017-11-01-preview" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json deleted file mode 100644 index dc6519555c3ac..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "chosen_version": "2017-11-01-preview", - "total_api_version_list": ["2017-11-01-preview"], - "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", - "description": "Monitor Management Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - } - }, - "constant": { - }, - "call": "credential", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "metric_baseline": "MetricBaselineOperations" - } -} \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py deleted file mode 100644 index 54b7a3e3d3f56..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py +++ /dev/null @@ -1,89 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -from . import models -from ._configuration import MonitorManagementClientConfiguration -from .operations import MetricBaselineOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class MonitorManagementClient: - """Monitor Management Client. - - :ivar metric_baseline: MetricBaselineOperations operations - :vartype metric_baseline: - $(python-base-namespace).v2017_11_01_preview.operations.MetricBaselineOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - """ - - def __init__( - self, - credential: "TokenCredential", - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = MonitorManagementClientConfiguration(credential=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._serialize.client_side_validation = False - self.metric_baseline = MetricBaselineOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> MonitorManagementClient - 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/v2017_11_01_preview/_patch.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_patch.py deleted file mode 100644 index 74e48ecd07cf3..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_vendor.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_vendor.py deleted file mode 100644 index 138f663c53a4e..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_version.py deleted file mode 100644 index 47babc28d5edf..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "3.1.0" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/__init__.py deleted file mode 100644 index 4eba911f1c6ec..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license 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_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py deleted file mode 100644 index b94ccd520e188..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. - - 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: - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.api_version = "2017-11-01-preview" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_management_client.py deleted file mode 100644 index 294998b3c92d0..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_management_client.py +++ /dev/null @@ -1,86 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -from .. import models -from ._configuration import MonitorManagementClientConfiguration -from .operations import MetricBaselineOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class MonitorManagementClient: - """Monitor Management Client. - - :ivar metric_baseline: MetricBaselineOperations operations - :vartype metric_baseline: - $(python-base-namespace).v2017_11_01_preview.aio.operations.MetricBaselineOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. - :type base_url: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = MonitorManagementClientConfiguration(credential=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._serialize.client_side_validation = False - self.metric_baseline = MetricBaselineOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "MonitorManagementClient": - 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/v2017_11_01_preview/aio/_patch.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07cf3..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/__init__.py deleted file mode 100644 index 04cb64ccf6304..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._metric_baseline_operations import MetricBaselineOperations - -__all__ = [ - 'MetricBaselineOperations', -] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py deleted file mode 100644 index c8caf0224f939..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py +++ /dev/null @@ -1,182 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._metric_baseline_operations import build_calculate_baseline_request, build_get_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MetricBaselineOperations: - """MetricBaselineOperations 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_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_uri: str, - metric_name: str, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "_models.ResultType"]] = None, - **kwargs: Any - ) -> "_models.BaselineResponse": - """**Gets the baseline values for a specific metric**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param metric_name: The name of the metric to retrieve the baseline for. - :type metric_name: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. - :type interval: ~datetime.timedelta - :param aggregation: The aggregation type of the metric to retrieve the baseline for. - :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. - :type sensitivities: str - :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. - :type result_type: str or ~$(python-base-namespace).v2017_11_01_preview.models.ResultType - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2017_11_01_preview.models.BaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_uri=resource_uri, - metric_name=metric_name, - timespan=timespan, - interval=interval, - aggregation=aggregation, - sensitivities=sensitivities, - result_type=result_type, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore - - - @distributed_trace_async - async def calculate_baseline( - self, - resource_uri: str, - time_series_information: "_models.TimeSeriesInformation", - **kwargs: Any - ) -> "_models.CalculateBaselineResponse": - """**Lists the baseline values for a resource**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param time_series_information: Information that need to be specified to calculate a baseline - on a time series. - :type time_series_information: - ~$(python-base-namespace).v2017_11_01_preview.models.TimeSeriesInformation - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CalculateBaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2017_11_01_preview.models.CalculateBaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateBaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(time_series_information, 'TimeSeriesInformation') - - request = build_calculate_baseline_request( - resource_uri=resource_uri, - content_type=content_type, - json=_json, - template_url=self.calculate_baseline.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore - diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py deleted file mode 100644 index 5ed46c55c546c..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import Baseline -from ._models_py3 import BaselineMetadataValue -from ._models_py3 import BaselineResponse -from ._models_py3 import CalculateBaselineResponse -from ._models_py3 import ErrorResponse -from ._models_py3 import LocalizableString -from ._models_py3 import TimeSeriesInformation - - -from ._monitor_management_client_enums import ( - ResultType, - Sensitivity, -) - -__all__ = [ - 'Baseline', - 'BaselineMetadataValue', - 'BaselineResponse', - 'CalculateBaselineResponse', - 'ErrorResponse', - 'LocalizableString', - 'TimeSeriesInformation', - 'ResultType', - 'Sensitivity', -] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py deleted file mode 100644 index ddf9d5c536cf4..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py +++ /dev/null @@ -1,355 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import List, Optional, Union - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - -from ._monitor_management_client_enums import * - - -class Baseline(msrest.serialization.Model): - """The baseline values for a single sensitivity value. - - All required parameters must be populated in order to send to Azure. - - :ivar sensitivity: Required. the sensitivity of the baseline. Possible values include: "Low", - "Medium", "High". - :vartype sensitivity: str or ~$(python-base-namespace).v2017_11_01_preview.models.Sensitivity - :ivar low_thresholds: Required. The low thresholds of the baseline. - :vartype low_thresholds: list[float] - :ivar high_thresholds: Required. The high thresholds of the baseline. - :vartype high_thresholds: list[float] - :ivar timestamps: the array of timestamps of the baselines. - :vartype timestamps: list[~datetime.datetime] - """ - - _validation = { - 'sensitivity': {'required': True}, - 'low_thresholds': {'required': True}, - 'high_thresholds': {'required': True}, - } - - _attribute_map = { - 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, - 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, - 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, - 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, - } - - def __init__( - self, - *, - sensitivity: Union[str, "Sensitivity"], - low_thresholds: List[float], - high_thresholds: List[float], - timestamps: Optional[List[datetime.datetime]] = None, - **kwargs - ): - """ - :keyword sensitivity: Required. the sensitivity of the baseline. Possible values include: - "Low", "Medium", "High". - :paramtype sensitivity: str or ~$(python-base-namespace).v2017_11_01_preview.models.Sensitivity - :keyword low_thresholds: Required. The low thresholds of the baseline. - :paramtype low_thresholds: list[float] - :keyword high_thresholds: Required. The high thresholds of the baseline. - :paramtype high_thresholds: list[float] - :keyword timestamps: the array of timestamps of the baselines. - :paramtype timestamps: list[~datetime.datetime] - """ - super(Baseline, self).__init__(**kwargs) - self.sensitivity = sensitivity - self.low_thresholds = low_thresholds - self.high_thresholds = high_thresholds - self.timestamps = timestamps - - -class BaselineMetadataValue(msrest.serialization.Model): - """Represents a baseline metadata value. - - :ivar name: the name of the metadata. - :vartype name: ~$(python-base-namespace).v2017_11_01_preview.models.LocalizableString - :ivar value: the value of the metadata. - :vartype value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'LocalizableString'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional["LocalizableString"] = None, - value: Optional[str] = None, - **kwargs - ): - """ - :keyword name: the name of the metadata. - :paramtype name: ~$(python-base-namespace).v2017_11_01_preview.models.LocalizableString - :keyword value: the value of the metadata. - :paramtype value: str - """ - super(BaselineMetadataValue, self).__init__(**kwargs) - self.name = name - self.value = value - - -class BaselineResponse(msrest.serialization.Model): - """The response to a baseline query. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: the metric baseline Id. - :vartype id: str - :ivar type: the resource type of the baseline resource. - :vartype type: str - :ivar name: the name and the display name of the metric, i.e. it is localizable string. - :vartype name: ~$(python-base-namespace).v2017_11_01_preview.models.LocalizableString - :ivar timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. - :vartype timespan: str - :ivar interval: The interval (window size) for which the metric data was returned in. This may - be adjusted in the future and returned back from what was originally requested. This is not - present if a metadata request was made. - :vartype interval: ~datetime.timedelta - :ivar aggregation: The aggregation type of the metric. - :vartype aggregation: str - :ivar timestamps: the array of timestamps of the baselines. - :vartype timestamps: list[~datetime.datetime] - :ivar baseline: the baseline values for each sensitivity. - :vartype baseline: list[~$(python-base-namespace).v2017_11_01_preview.models.Baseline] - :ivar metadata: the baseline metadata values. - :vartype metadata: - list[~$(python-base-namespace).v2017_11_01_preview.models.BaselineMetadataValue] - """ - - _validation = { - 'id': {'readonly': True}, - 'type': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'LocalizableString'}, - 'timespan': {'key': 'properties.timespan', 'type': 'str'}, - 'interval': {'key': 'properties.interval', 'type': 'duration'}, - 'aggregation': {'key': 'properties.aggregation', 'type': 'str'}, - 'timestamps': {'key': 'properties.timestamps', 'type': '[iso-8601]'}, - 'baseline': {'key': 'properties.baseline', 'type': '[Baseline]'}, - 'metadata': {'key': 'properties.metadata', 'type': '[BaselineMetadataValue]'}, - } - - def __init__( - self, - *, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - timestamps: Optional[List[datetime.datetime]] = None, - baseline: Optional[List["Baseline"]] = None, - metadata: Optional[List["BaselineMetadataValue"]] = None, - **kwargs - ): - """ - :keyword timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. - :paramtype timespan: str - :keyword interval: The interval (window size) for which the metric data was returned in. This - may be adjusted in the future and returned back from what was originally requested. This is - not present if a metadata request was made. - :paramtype interval: ~datetime.timedelta - :keyword aggregation: The aggregation type of the metric. - :paramtype aggregation: str - :keyword timestamps: the array of timestamps of the baselines. - :paramtype timestamps: list[~datetime.datetime] - :keyword baseline: the baseline values for each sensitivity. - :paramtype baseline: list[~$(python-base-namespace).v2017_11_01_preview.models.Baseline] - :keyword metadata: the baseline metadata values. - :paramtype metadata: - list[~$(python-base-namespace).v2017_11_01_preview.models.BaselineMetadataValue] - """ - super(BaselineResponse, self).__init__(**kwargs) - self.id = None - self.type = None - self.name = None - self.timespan = timespan - self.interval = interval - self.aggregation = aggregation - self.timestamps = timestamps - self.baseline = baseline - self.metadata = metadata - - -class CalculateBaselineResponse(msrest.serialization.Model): - """The response to a calculate baseline call. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. the resource type of the baseline resource. - :vartype type: str - :ivar timestamps: the array of timestamps of the baselines. - :vartype timestamps: list[~datetime.datetime] - :ivar baseline: Required. the baseline values for each sensitivity. - :vartype baseline: list[~$(python-base-namespace).v2017_11_01_preview.models.Baseline] - """ - - _validation = { - 'type': {'required': True}, - 'baseline': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, - 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, - } - - def __init__( - self, - *, - type: str, - baseline: List["Baseline"], - timestamps: Optional[List[datetime.datetime]] = None, - **kwargs - ): - """ - :keyword type: Required. the resource type of the baseline resource. - :paramtype type: str - :keyword timestamps: the array of timestamps of the baselines. - :paramtype timestamps: list[~datetime.datetime] - :keyword baseline: Required. the baseline values for each sensitivity. - :paramtype baseline: list[~$(python-base-namespace).v2017_11_01_preview.models.Baseline] - """ - super(CalculateBaselineResponse, self).__init__(**kwargs) - self.type = type - self.timestamps = timestamps - self.baseline = baseline - - -class ErrorResponse(msrest.serialization.Model): - """Describes the format of Error response. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message indicating why the operation failed. - :paramtype message: str - """ - super(ErrorResponse, self).__init__(**kwargs) - self.code = code - self.message = message - - -class LocalizableString(msrest.serialization.Model): - """The localizable string class. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. the invariant value. - :vartype value: str - :ivar localized_value: the locale specific value. - :vartype localized_value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - *, - value: str, - localized_value: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Required. the invariant value. - :paramtype value: str - :keyword localized_value: the locale specific value. - :paramtype localized_value: str - """ - super(LocalizableString, self).__init__(**kwargs) - self.value = value - self.localized_value = localized_value - - -class TimeSeriesInformation(msrest.serialization.Model): - """The time series info needed for calculating the baseline. - - All required parameters must be populated in order to send to Azure. - - :ivar sensitivities: Required. the list of sensitivities for calculating the baseline. - :vartype sensitivities: list[str] - :ivar values: Required. The metric values to calculate the baseline. - :vartype values: list[float] - :ivar timestamps: the array of timestamps of the baselines. - :vartype timestamps: list[~datetime.datetime] - """ - - _validation = { - 'sensitivities': {'required': True}, - 'values': {'required': True}, - } - - _attribute_map = { - 'sensitivities': {'key': 'sensitivities', 'type': '[str]'}, - 'values': {'key': 'values', 'type': '[float]'}, - 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, - } - - def __init__( - self, - *, - sensitivities: List[str], - values: List[float], - timestamps: Optional[List[datetime.datetime]] = None, - **kwargs - ): - """ - :keyword sensitivities: Required. the list of sensitivities for calculating the baseline. - :paramtype sensitivities: list[str] - :keyword values: Required. The metric values to calculate the baseline. - :paramtype values: list[float] - :keyword timestamps: the array of timestamps of the baselines. - :paramtype timestamps: list[~datetime.datetime] - """ - super(TimeSeriesInformation, self).__init__(**kwargs) - self.sensitivities = sensitivities - self.values = values - self.timestamps = timestamps diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_management_client_enums.py deleted file mode 100644 index 84dc084ea9ed8..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_management_client_enums.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -class ResultType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - - DATA = "Data" - METADATA = "Metadata" - -class Sensitivity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """the sensitivity of the baseline. - """ - - LOW = "Low" - MEDIUM = "Medium" - HIGH = "High" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/__init__.py deleted file mode 100644 index 04cb64ccf6304..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._metric_baseline_operations import MetricBaselineOperations - -__all__ = [ - 'MetricBaselineOperations', -] 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 deleted file mode 100644 index 872dfcde5bcaa..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py +++ /dev/null @@ -1,274 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - resource_uri: str, - metric_name: str, - *, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "_models.ResultType"]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = "2017-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}') - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), - "metricName": _SERIALIZER.url("metric_name", metric_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - if timespan is not None: - query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') - if interval is not None: - query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') - if aggregation is not None: - query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') - if sensitivities is not None: - query_parameters['sensitivities'] = _SERIALIZER.query("sensitivities", sensitivities, 'str') - if result_type is not None: - query_parameters['resultType'] = _SERIALIZER.query("result_type", result_type, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_calculate_baseline_request( - resource_uri: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2017-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline') - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -class MetricBaselineOperations(object): - """MetricBaselineOperations 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_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_uri: str, - metric_name: str, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "_models.ResultType"]] = None, - **kwargs: Any - ) -> "_models.BaselineResponse": - """**Gets the baseline values for a specific metric**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param metric_name: The name of the metric to retrieve the baseline for. - :type metric_name: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. - :type interval: ~datetime.timedelta - :param aggregation: The aggregation type of the metric to retrieve the baseline for. - :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. - :type sensitivities: str - :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. - :type result_type: str or ~$(python-base-namespace).v2017_11_01_preview.models.ResultType - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2017_11_01_preview.models.BaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_uri=resource_uri, - metric_name=metric_name, - timespan=timespan, - interval=interval, - aggregation=aggregation, - sensitivities=sensitivities, - result_type=result_type, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore - - - @distributed_trace - def calculate_baseline( - self, - resource_uri: str, - time_series_information: "_models.TimeSeriesInformation", - **kwargs: Any - ) -> "_models.CalculateBaselineResponse": - """**Lists the baseline values for a resource**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param time_series_information: Information that need to be specified to calculate a baseline - on a time series. - :type time_series_information: - ~$(python-base-namespace).v2017_11_01_preview.models.TimeSeriesInformation - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CalculateBaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2017_11_01_preview.models.CalculateBaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateBaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(time_series_information, 'TimeSeriesInformation') - - request = build_calculate_baseline_request( - resource_uri=resource_uri, - content_type=content_type, - json=_json, - template_url=self.calculate_baseline.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore - diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/py.typed b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py index e6aeff663d71e..c74500c3adc6e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2017-12-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-12-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2017-12-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json index 18bc077c7cd89..847e5716bee0a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py index c477802680d4f..b5ea612b5a476 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -29,8 +30,11 @@ class MonitorManagementClient: $(python-base-namespace).v2017_12_01_preview.operations.MetricNamespacesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-12-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -51,7 +55,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py index cf4b6135bb510..0298239a68102 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2017-12-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-12-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2017-12-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_management_client.py index da77ac77c9fa5..2270d2d12f6c7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -29,8 +30,11 @@ class MonitorManagementClient: $(python-base-namespace).v2017_12_01_preview.aio.operations.MetricNamespacesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-12-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py index f58ee93aa86d6..cf8b995d4462d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -58,7 +56,7 @@ def list( :param resource_uri: The identifier of the resource. :type resource_uri: str :param start_time: The ISO 8601 conform Date start time from which to query for metric - namespaces. + namespaces. Default value is None. :type start_time: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricNamespaceCollection or the result of @@ -67,6 +65,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2017_12_01_preview.models.MetricNamespaceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricNamespaceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -77,6 +77,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, start_time=start_time, template_url=self.list.metadata['url'], ) @@ -87,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, start_time=start_time, template_url=next_link, ) @@ -105,7 +107,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -119,4 +125,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricNamespaces'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metricNamespaces"} # type: ignore 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 44f3cf0e91599..3b64e71d99d4c 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_list_request( start_time: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01-preview" + api_version = kwargs.pop('api_version', "2017-12-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/metricNamespaces') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/metricNamespaces") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if start_time is not None: - query_parameters['startTime'] = _SERIALIZER.query("start_time", start_time, 'str') + _query_parameters['startTime'] = _SERIALIZER.query("start_time", start_time, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -94,7 +95,7 @@ def list( :param resource_uri: The identifier of the resource. :type resource_uri: str :param start_time: The ISO 8601 conform Date start time from which to query for metric - namespaces. + namespaces. Default value is None. :type start_time: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricNamespaceCollection or the result of @@ -103,6 +104,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2017_12_01_preview.models.MetricNamespaceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricNamespaceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -113,6 +116,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, start_time=start_time, template_url=self.list.metadata['url'], ) @@ -123,6 +127,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, start_time=start_time, template_url=next_link, ) @@ -141,7 +146,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -155,4 +164,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricNamespaces'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/metricNamespaces"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py index 140c72aa1b0c4..2b64ba9b08e42 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2018-01-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-01-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2018-01-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json index 99fa18757f37c..d26da9081753e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py index a539766bbfaa0..92c1e3cbab7e9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :vartype metrics: $(python-base-namespace).v2018_01_01.operations.MetricsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-01-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -54,7 +58,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py index cffdc2d34b319..628dab438b999 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2018-01-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-01-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2018-01-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_management_client.py index 11c57b3a714aa..04b70e5ba7988 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :vartype metrics: $(python-base-namespace).v2018_01_01.aio.operations.MetricsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-01-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py index fda3b5ccdbe23..4edd02f69e310 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -57,7 +55,8 @@ def list( :param resource_uri: The identifier of the resource. :type resource_uri: str - :param metricnamespace: Metric namespace to query metric definitions for. + :param metricnamespace: Metric namespace to query metric definitions for. Default value is + None. :type metricnamespace: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricDefinitionCollection or the result of @@ -66,6 +65,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_01_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-01-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, metricnamespace=metricnamespace, template_url=self.list.metadata['url'], ) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, metricnamespace=metricnamespace, template_url=next_link, ) @@ -104,7 +107,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,4 +125,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py index bc650c2c02f17..084897a0d91c3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -65,23 +64,24 @@ async def list( :param resource_uri: The identifier of the resource. :type resource_uri: str :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. + 'startDateTime_ISO/endDateTime_ISO'. Default value is None. :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. + :param interval: The interval (i.e. timegrain) of the query. Default value is None. :type interval: ~datetime.timedelta :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. + **'Metric%2Name1'**. Default value is None. :type metricnames: str - :param aggregation: The list of aggregation types (comma separated) to retrieve. + :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value + is None. :type aggregation: str :param top: The maximum number of records to retrieve. Valid only if $filter is specified. - Defaults to 10. + Defaults to 10. Default value is None. :type top: int :param orderby: The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. - Examples: sum asc. + Examples: sum asc. Default value is None. :type orderby: str :param filter: The **$filter** is used to reduce the set of metric data returned. Example: Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or @@ -94,12 +94,13 @@ async def list( Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim - %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. Default value is None. :type filter: str :param result_type: Reduces the set of data collected. The syntax allowed depends on the - operation. See the operation's description for details. + operation. See the operation's description for details. Default value is None. :type result_type: str or ~$(python-base-namespace).v2018_01_01.models.ResultType - :param metricnamespace: Metric namespace to query metric definitions for. + :param metricnamespace: Metric namespace to query metric definitions for. Default value is + None. :type metricnamespace: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Response, or the result of cls(response) @@ -112,9 +113,12 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-01-01") # type: str + request = build_list_request( resource_uri=resource_uri, + api_version=api_version, timespan=timespan, interval=interval, metricnames=metricnames, @@ -129,7 +133,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -144,5 +152,5 @@ async def list( return deserialized - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metrics'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/metrics"} # type: ignore 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 d4fbf7397d34b..0f1f2ad468045 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_list_request( metricnamespace: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-01-01" + api_version = kwargs.pop('api_version', "2018-01-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if metricnamespace is not None: - query_parameters['metricnamespace'] = _SERIALIZER.query("metricnamespace", metricnamespace, 'str') + _query_parameters['metricnamespace'] = _SERIALIZER.query("metricnamespace", metricnamespace, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -93,7 +94,8 @@ def list( :param resource_uri: The identifier of the resource. :type resource_uri: str - :param metricnamespace: Metric namespace to query metric definitions for. + :param metricnamespace: Metric namespace to query metric definitions for. Default value is + None. :type metricnamespace: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricDefinitionCollection or the result of @@ -102,6 +104,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_01_01.models.MetricDefinitionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-01-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -112,6 +116,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, metricnamespace=metricnamespace, template_url=self.list.metadata['url'], ) @@ -122,6 +127,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, metricnamespace=metricnamespace, template_url=next_link, ) @@ -140,7 +146,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -154,4 +164,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions"} # type: ignore 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 526a3d88304c0..7e6cc3bf61f78 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,47 +40,48 @@ def build_list_request( metricnamespace: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-01-01" + api_version = kwargs.pop('api_version', "2018-01-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/metrics') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/metrics") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if timespan is not None: - query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') + _query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') if interval is not None: - query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') + _query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') if metricnames is not None: - query_parameters['metricnames'] = _SERIALIZER.query("metricnames", metricnames, 'str') + _query_parameters['metricnames'] = _SERIALIZER.query("metricnames", metricnames, 'str') if aggregation is not None: - query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') + _query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') if top is not None: - query_parameters['top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['top'] = _SERIALIZER.query("top", top, 'int') if orderby is not None: - query_parameters['orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _query_parameters['orderby'] = _SERIALIZER.query("orderby", orderby, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if result_type is not None: - query_parameters['resultType'] = _SERIALIZER.query("result_type", result_type, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['resultType'] = _SERIALIZER.query("result_type", result_type, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if metricnamespace is not None: - query_parameters['metricnamespace'] = _SERIALIZER.query("metricnamespace", metricnamespace, 'str') + _query_parameters['metricnamespace'] = _SERIALIZER.query("metricnamespace", metricnamespace, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -126,23 +127,24 @@ def list( :param resource_uri: The identifier of the resource. :type resource_uri: str :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. + 'startDateTime_ISO/endDateTime_ISO'. Default value is None. :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. + :param interval: The interval (i.e. timegrain) of the query. Default value is None. :type interval: ~datetime.timedelta :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. + **'Metric%2Name1'**. Default value is None. :type metricnames: str - :param aggregation: The list of aggregation types (comma separated) to retrieve. + :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value + is None. :type aggregation: str :param top: The maximum number of records to retrieve. Valid only if $filter is specified. - Defaults to 10. + Defaults to 10. Default value is None. :type top: int :param orderby: The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. - Examples: sum asc. + Examples: sum asc. Default value is None. :type orderby: str :param filter: The **$filter** is used to reduce the set of metric data returned. Example: Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or @@ -155,12 +157,13 @@ def list( Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim - %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. Default value is None. :type filter: str :param result_type: Reduces the set of data collected. The syntax allowed depends on the - operation. See the operation's description for details. + operation. See the operation's description for details. Default value is None. :type result_type: str or ~$(python-base-namespace).v2018_01_01.models.ResultType - :param metricnamespace: Metric namespace to query metric definitions for. + :param metricnamespace: Metric namespace to query metric definitions for. Default value is + None. :type metricnamespace: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Response, or the result of cls(response) @@ -173,9 +176,12 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-01-01") # type: str + request = build_list_request( resource_uri=resource_uri, + api_version=api_version, timespan=timespan, interval=interval, metricnames=metricnames, @@ -190,7 +196,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -205,5 +215,5 @@ def list( return deserialized - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metrics'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/metrics"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py index 02f3bff47a578..d38615cce33f7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-03-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json index 29e4460a8b759..4b154548b576a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py index 0096c6fd0b186..4000a53040168 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -35,8 +36,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -60,7 +64,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py index f68f113b2fde5..956d837ce56ca 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-03-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_management_client.py index 42cd3189dd06c..bbece79fbeeaa 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -37,8 +38,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py index 87b98768d8b0f..969685c5db7e1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -81,6 +81,7 @@ async def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,7 +112,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -134,17 +139,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,11 +171,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -186,17 +198,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -207,7 +226,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -237,6 +256,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -245,6 +265,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -252,7 +273,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,7 +292,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -283,6 +308,8 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -293,6 +320,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -302,6 +330,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -319,7 +348,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -333,7 +366,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -351,6 +384,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -362,6 +397,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -372,6 +408,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -389,7 +426,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -403,10 +444,10 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace_async - async def enable_receiver( + async def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -433,6 +474,7 @@ async def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -441,6 +483,7 @@ async def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -448,7 +491,11 @@ async def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -459,5 +506,5 @@ async def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py index 6b4ff7fc1c348..052d27043569d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -60,6 +59,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_03_01.models.MetricAlertResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -70,6 +71,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -79,6 +81,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -96,7 +99,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -129,6 +136,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_03_01.models.MetricAlertResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -140,6 +149,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -150,6 +160,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -167,7 +178,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -181,7 +196,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts"} # type: ignore @distributed_trace_async async def get( @@ -207,17 +222,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -232,7 +254,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}"} # type: ignore @distributed_trace_async @@ -262,6 +284,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'MetricAlertResource') @@ -270,6 +293,7 @@ async def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -277,7 +301,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -292,7 +320,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}"} # type: ignore @distributed_trace_async @@ -322,6 +350,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'MetricAlertResourcePatch') @@ -330,6 +359,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -337,7 +367,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -352,11 +386,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -379,17 +413,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -400,5 +441,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py index 8be671ebb3852..91d4bfbf1c1ae 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -68,17 +67,24 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,7 +99,7 @@ async def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status"} # type: ignore @distributed_trace_async @@ -123,18 +129,25 @@ async def list_by_name( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_list_by_name_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, status_name=status_name, + api_version=api_version, template_url=self.list_by_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -149,5 +162,5 @@ async def list_by_name( return deserialized - list_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}'} # type: ignore + list_by_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}"} # type: ignore 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 414a2fd904712..be16a5e80e953 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -189,29 +191,30 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -221,30 +224,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -258,35 +262,35 @@ def build_enable_receiver_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -341,6 +345,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -349,6 +354,7 @@ def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -356,7 +362,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -375,7 +385,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -402,17 +412,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -427,11 +444,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -454,17 +471,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -475,7 +499,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -505,6 +529,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -513,6 +538,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -520,7 +546,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -535,7 +565,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -551,6 +581,8 @@ def list_by_subscription_id( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -561,6 +593,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -570,6 +603,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -587,7 +621,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,7 +639,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -619,6 +657,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -630,6 +670,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -640,6 +681,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -657,7 +699,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -671,10 +717,10 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace - def enable_receiver( + def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -701,6 +747,7 @@ def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -709,6 +756,7 @@ def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -716,7 +764,11 @@ def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -727,5 +779,5 @@ def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore 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 4fa32fef790b9..63b3bf3cfc4c7 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +64,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,31 +99,32 @@ def build_get_request( rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,35 +138,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -179,35 +182,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -220,31 +223,32 @@ def build_delete_request( rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -284,6 +288,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_03_01.models.MetricAlertResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -294,6 +300,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -303,6 +310,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -320,7 +328,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -334,7 +346,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -353,6 +365,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_03_01.models.MetricAlertResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricAlertResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +378,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -374,6 +389,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -391,7 +407,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,7 +425,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts"} # type: ignore @distributed_trace def get( @@ -431,17 +451,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -456,7 +483,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}"} # type: ignore @distributed_trace @@ -486,6 +513,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'MetricAlertResource') @@ -494,6 +522,7 @@ def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -501,7 +530,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -516,7 +549,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}"} # type: ignore @distributed_trace @@ -546,6 +579,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'MetricAlertResourcePatch') @@ -554,6 +588,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -561,7 +596,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -576,11 +615,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -603,17 +642,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -624,5 +670,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}"} # type: ignore 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 05b7c8f94d81c..73bdff8f1dca3 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,31 +31,32 @@ def build_list_request( rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -67,10 +68,11 @@ def build_list_by_name_request( status_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-03-01" + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -78,21 +80,21 @@ def build_list_by_name_request( "statusName": _SERIALIZER.url("status_name", status_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -142,17 +144,24 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -167,7 +176,7 @@ def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status"} # type: ignore @distributed_trace @@ -197,18 +206,25 @@ def list_by_name( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-03-01") # type: str + request = build_list_by_name_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, status_name=status_name, + api_version=api_version, template_url=self.list_by_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -223,5 +239,5 @@ def list_by_name( return deserialized - list_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}'} # type: ignore + list_by_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py index 6fb25c5332d83..4553ba117c46b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-04-16". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-04-16" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json index 14e0dd2031244..1e742490f1c0a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_management_client.py index e41f474166571..12227612036ec 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-04-16". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -54,7 +58,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py index 8af9a49138cd7..a851ec39e3875 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-04-16". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-04-16" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_management_client.py index c73fd5d4fc0e6..e6249c14731d4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-04-16". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py index e85418a0b0303..d431bb1d6e5be 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'LogSearchRuleResource') @@ -81,6 +81,7 @@ async def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,7 +112,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace_async @@ -134,17 +139,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,7 +171,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace_async @@ -189,6 +201,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'LogSearchRuleResourcePatch') @@ -197,6 +210,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -204,7 +218,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -219,11 +237,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -246,17 +264,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + request = build_delete_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -267,7 +292,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace @@ -279,7 +304,7 @@ def list_by_subscription( """List the Log Search rules within a subscription group. :param filter: The filter to apply on the operation. For more information please see - https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LogSearchRuleResourceCollection or the result of @@ -288,6 +313,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -298,6 +325,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list_by_subscription.metadata['url'], ) @@ -308,6 +336,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -326,7 +355,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -340,7 +373,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules"} # type: ignore @distributed_trace def list_by_resource_group( @@ -354,7 +387,7 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param filter: The filter to apply on the operation. For more information please see - https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LogSearchRuleResourceCollection or the result of @@ -363,6 +396,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -374,6 +409,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list_by_resource_group.metadata['url'], ) @@ -385,6 +421,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -403,7 +440,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -417,4 +458,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules"} # type: ignore 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 1c948e2cac154..cface6b4f6673 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-16") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-16" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-16" + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -115,35 +116,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-16") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-16" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -156,31 +157,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-16" + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -191,31 +193,32 @@ def build_list_by_subscription_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-16" + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -227,32 +230,33 @@ def build_list_by_resource_group_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-16" + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -305,6 +309,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'LogSearchRuleResource') @@ -313,6 +318,7 @@ def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -320,7 +326,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,7 +349,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace @@ -366,17 +376,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + request = build_get_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -391,7 +408,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace @@ -421,6 +438,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'LogSearchRuleResourcePatch') @@ -429,6 +447,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -436,7 +455,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -451,11 +474,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -478,17 +501,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + request = build_delete_request( resource_group_name=resource_group_name, rule_name=rule_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -499,7 +529,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace @@ -511,7 +541,7 @@ def list_by_subscription( """List the Log Search rules within a subscription group. :param filter: The filter to apply on the operation. For more information please see - https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LogSearchRuleResourceCollection or the result of @@ -520,6 +550,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +562,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list_by_subscription.metadata['url'], ) @@ -540,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -558,7 +592,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -572,7 +610,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules"} # type: ignore @distributed_trace def list_by_resource_group( @@ -586,7 +624,7 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param filter: The filter to apply on the operation. For more information please see - https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LogSearchRuleResourceCollection or the result of @@ -595,6 +633,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_04_16.models.LogSearchRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-16") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogSearchRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -606,6 +646,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list_by_resource_group.metadata['url'], ) @@ -617,6 +658,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -635,7 +677,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -649,4 +695,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py index cc2cd2e5d57c8..676df20cf3376 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-06-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json index 5aeafd91a05de..21edf7fba84b5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py index f0184e69c831a..fea5d892da217 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -35,8 +36,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -59,7 +63,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py index f4bfd21725968..2da71a16292c0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-06-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_management_client.py index 6a2eb35ec8f39..d38a1100b82ca 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -35,8 +36,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py index 80d6e126d47d4..c1710ce8ed618 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -77,6 +76,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_settings_association, 'GuestDiagnosticSettingsAssociationResource') @@ -84,6 +84,7 @@ async def create_or_update( request = build_create_or_update_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -91,7 +92,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -110,7 +115,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}"} # type: ignore @distributed_trace_async @@ -139,16 +144,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -163,11 +175,11 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, association_name: str, @@ -191,16 +203,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -211,7 +230,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}"} # type: ignore @distributed_trace_async @@ -245,6 +264,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'GuestDiagnosticSettingsAssociationResourcePatch') @@ -252,6 +272,7 @@ async def update( request = build_update_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -259,7 +280,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -274,7 +299,7 @@ async def update( return deserialized - update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} # type: ignore + update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}"} # type: ignore @distributed_trace @@ -291,6 +316,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -301,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -310,6 +338,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -327,7 +356,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -341,7 +374,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettingsAssociations'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettingsAssociations"} # type: ignore @distributed_trace def list_by_resource_group( @@ -360,6 +393,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +406,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -381,6 +417,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -398,7 +435,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -412,4 +453,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettingsAssociations'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettingsAssociations"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py index 2caa8649a8896..bfb4727e0ae00 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -74,6 +73,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_settings, 'GuestDiagnosticSettingsResource') @@ -82,6 +82,7 @@ async def create_or_update( resource_group_name=resource_group_name, diagnostic_settings_name=diagnostic_settings_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -89,7 +90,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -108,7 +113,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}"} # type: ignore @distributed_trace_async @@ -135,17 +140,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + request = build_get_request( resource_group_name=resource_group_name, diagnostic_settings_name=diagnostic_settings_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -160,7 +172,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}"} # type: ignore @distributed_trace_async @@ -191,6 +203,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'GuestDiagnosticSettingsPatchResource') @@ -199,6 +212,7 @@ async def update( resource_group_name=resource_group_name, diagnostic_settings_name=diagnostic_settings_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -206,7 +220,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -225,11 +243,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, diagnostic_settings_name: str, @@ -252,17 +270,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + request = build_delete_request( resource_group_name=resource_group_name, diagnostic_settings_name=diagnostic_settings_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -273,7 +298,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}"} # type: ignore @distributed_trace @@ -290,6 +315,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -300,6 +327,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -309,6 +337,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -326,7 +355,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -340,7 +373,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettings"} # type: ignore @distributed_trace def list_by_resource_group( @@ -359,6 +392,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +405,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -380,6 +416,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -397,7 +434,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -411,4 +452,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings"} # type: ignore 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 f0b56e14d6de5..ab3550256d125 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,34 +35,34 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -74,30 +74,31 @@ def build_get_request( association_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01-preview" + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,30 +108,31 @@ def build_delete_request( association_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01-preview" + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -143,34 +145,34 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -181,29 +183,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01-preview" + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettingsAssociations') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettingsAssociations") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -213,30 +216,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01-preview" + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettingsAssociations') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettingsAssociations") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -293,6 +297,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_settings_association, 'GuestDiagnosticSettingsAssociationResource') @@ -300,6 +305,7 @@ def create_or_update( request = build_create_or_update_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -307,7 +313,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -326,7 +336,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}"} # type: ignore @distributed_trace @@ -355,16 +365,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -379,11 +396,11 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, association_name: str, @@ -407,16 +424,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -427,7 +451,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}"} # type: ignore @distributed_trace @@ -461,6 +485,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'GuestDiagnosticSettingsAssociationResourcePatch') @@ -468,6 +493,7 @@ def update( request = build_update_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -475,7 +501,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -490,7 +520,7 @@ def update( return deserialized - update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}'} # type: ignore + update.metadata = {'url': "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}"} # type: ignore @distributed_trace @@ -507,6 +537,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -517,6 +549,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -526,6 +559,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -543,7 +577,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -557,7 +595,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettingsAssociations'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettingsAssociations"} # type: ignore @distributed_trace def list_by_resource_group( @@ -576,6 +614,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsAssociationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -587,6 +627,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -597,6 +638,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -614,7 +656,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -628,4 +674,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettingsAssociations'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettingsAssociations"} # type: ignore 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 ec1a75a48f6be..41679d1379adc 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "diagnosticSettingsName": _SERIALIZER.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01-preview" + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "diagnosticSettingsName": _SERIALIZER.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -115,35 +116,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "diagnosticSettingsName": _SERIALIZER.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -156,31 +157,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01-preview" + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "diagnosticSettingsName": _SERIALIZER.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -189,29 +191,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01-preview" + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettings") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -221,30 +224,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01-preview" + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -298,6 +302,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_settings, 'GuestDiagnosticSettingsResource') @@ -306,6 +311,7 @@ def create_or_update( resource_group_name=resource_group_name, diagnostic_settings_name=diagnostic_settings_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -313,7 +319,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -332,7 +342,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}"} # type: ignore @distributed_trace @@ -359,17 +369,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + request = build_get_request( resource_group_name=resource_group_name, diagnostic_settings_name=diagnostic_settings_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -384,7 +401,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}"} # type: ignore @distributed_trace @@ -415,6 +432,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'GuestDiagnosticSettingsPatchResource') @@ -423,6 +441,7 @@ def update( resource_group_name=resource_group_name, diagnostic_settings_name=diagnostic_settings_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -430,7 +449,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -449,11 +472,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, diagnostic_settings_name: str, @@ -476,17 +499,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + request = build_delete_request( resource_group_name=resource_group_name, diagnostic_settings_name=diagnostic_settings_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -497,7 +527,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}"} # type: ignore @distributed_trace @@ -514,6 +544,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -524,6 +556,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -533,6 +566,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -550,7 +584,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -564,7 +602,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettings"} # type: ignore @distributed_trace def list_by_resource_group( @@ -583,6 +621,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GuestDiagnosticSettingsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -594,6 +634,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -604,6 +645,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -621,7 +663,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -635,4 +681,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py index 58852411de438..a8eb4584c7e8d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-09-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json index 55a9c50840f2c..e2a8dbb9ee3d2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -97,8 +97,6 @@ "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "action_groups": "ActionGroupsOperations", - "metric_baseline": "MetricBaselineOperations", - "baseline": "BaselineOperations" + "action_groups": "ActionGroupsOperations" } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py index ac4a74437887c..d5b05f8dd33d4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py @@ -7,15 +7,16 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration -from .operations import ActionGroupsOperations, BaselineOperations, MetricBaselineOperations +from .operations import ActionGroupsOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -26,17 +27,15 @@ class MonitorManagementClient: :ivar action_groups: ActionGroupsOperations operations :vartype action_groups: $(python-base-namespace).v2018_09_01.operations.ActionGroupsOperations - :ivar metric_baseline: MetricBaselineOperations operations - :vartype metric_baseline: - $(python-base-namespace).v2018_09_01.operations.MetricBaselineOperations - :ivar baseline: BaselineOperations operations - :vartype baseline: $(python-base-namespace).v2018_09_01.operations.BaselineOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -54,13 +53,11 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.action_groups = ActionGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.metric_baseline = MetricBaselineOperations(self._client, self._config, self._serialize, self._deserialize) - self.baseline = BaselineOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py index 3149ad11a3626..6eba1f68a2b82 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-09-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_management_client.py index 13df9dc4d0553..769083e95a9f6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_management_client.py @@ -7,15 +7,16 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration -from .operations import ActionGroupsOperations, BaselineOperations, MetricBaselineOperations +from .operations import ActionGroupsOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -27,17 +28,15 @@ class MonitorManagementClient: :ivar action_groups: ActionGroupsOperations operations :vartype action_groups: $(python-base-namespace).v2018_09_01.aio.operations.ActionGroupsOperations - :ivar metric_baseline: MetricBaselineOperations operations - :vartype metric_baseline: - $(python-base-namespace).v2018_09_01.aio.operations.MetricBaselineOperations - :ivar baseline: BaselineOperations operations - :vartype baseline: $(python-base-namespace).v2018_09_01.aio.operations.BaselineOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -55,8 +54,6 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.action_groups = ActionGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.metric_baseline = MetricBaselineOperations(self._client, self._config, self._serialize, self._deserialize) - self.baseline = BaselineOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/__init__.py index 636f48f0362a0..dc488c51fcad0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/__init__.py @@ -7,11 +7,7 @@ # -------------------------------------------------------------------------- from ._action_groups_operations import ActionGroupsOperations -from ._metric_baseline_operations import MetricBaselineOperations -from ._baseline_operations import BaselineOperations __all__ = [ 'ActionGroupsOperations', - 'MetricBaselineOperations', - 'BaselineOperations', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py index 0ba01330e7c1a..1e74b4dcc4460 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -81,6 +81,7 @@ async def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,7 +112,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -134,17 +139,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,11 +171,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -186,17 +198,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -207,7 +226,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -237,6 +256,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -245,6 +265,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -252,7 +273,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,7 +292,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -283,6 +308,8 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -293,6 +320,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -302,6 +330,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -319,7 +348,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -333,7 +366,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -351,6 +384,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -362,6 +397,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -372,6 +408,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -389,7 +426,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -403,10 +444,10 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace_async - async def enable_receiver( + async def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -433,6 +474,7 @@ async def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -441,6 +483,7 @@ async def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -448,7 +491,11 @@ async def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -459,5 +506,5 @@ async def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py deleted file mode 100644 index 13ea4d73c051a..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._baseline_operations import build_get_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BaselineOperations: - """BaselineOperations 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).v2018_09_01.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 - - @distributed_trace_async - async def get( - self, - resource_uri: str, - metricnames: Optional[str] = None, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "_models.ResultType"]] = None, - metricnamespace: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> "_models.BaselineResponse": - """**Gets the baseline values for a resource**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a - metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. - :type metricnames: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. - :type interval: ~datetime.timedelta - :param aggregation: The aggregation type of the metric to retrieve the baseline for. - :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. - :type sensitivities: str - :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. - :type result_type: str or ~$(python-base-namespace).v2018_09_01.models.ResultType - :param metricnamespace: Metric namespace to query metric definitions for. - :type metricnamespace: str - :param filter: The **$filter** is used to describe a set of dimensions with their concrete - values which produce a specific metric's time series, in which a baseline is requested for. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2018_09_01.models.BaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_uri=resource_uri, - metricnames=metricnames, - timespan=timespan, - interval=interval, - aggregation=aggregation, - sensitivities=sensitivities, - result_type=result_type, - metricnamespace=metricnamespace, - filter=filter, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline'} # type: ignore - diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py deleted file mode 100644 index 2837800f421e9..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py +++ /dev/null @@ -1,191 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._metric_baseline_operations import build_calculate_baseline_request, build_get_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MetricBaselineOperations: - """MetricBaselineOperations 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).v2018_09_01.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 - - @distributed_trace_async - async def get( - self, - resource_uri: str, - metric_name: str, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "_models.ResultType"]] = None, - metricnamespace: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> "_models.BaselineResponse": - """**Gets the baseline values for a specific metric**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param metric_name: The name of the metric to retrieve the baseline for. - :type metric_name: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. - :type interval: ~datetime.timedelta - :param aggregation: The aggregation type of the metric to retrieve the baseline for. - :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. - :type sensitivities: str - :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. - :type result_type: str or ~$(python-base-namespace).v2018_09_01.models.ResultType - :param metricnamespace: Metric namespace to query metric definitions for. - :type metricnamespace: str - :param filter: The **$filter** is used to describe a set of dimensions with their concrete - values which produce a specific metric's time series, in which a baseline is requested for. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2018_09_01.models.BaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_uri=resource_uri, - metric_name=metric_name, - timespan=timespan, - interval=interval, - aggregation=aggregation, - sensitivities=sensitivities, - result_type=result_type, - metricnamespace=metricnamespace, - filter=filter, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore - - - @distributed_trace_async - async def calculate_baseline( - self, - resource_uri: str, - time_series_information: "_models.TimeSeriesInformation", - **kwargs: Any - ) -> "_models.CalculateBaselineResponse": - """**Lists the baseline values for a resource**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param time_series_information: Information that need to be specified to calculate a baseline - on a time series. - :type time_series_information: - ~$(python-base-namespace).v2018_09_01.models.TimeSeriesInformation - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CalculateBaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2018_09_01.models.CalculateBaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateBaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(time_series_information, 'TimeSeriesInformation') - - request = build_calculate_baseline_request( - resource_uri=resource_uri, - content_type=content_type, - json=_json, - template_url=self.calculate_baseline.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore - diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py index ea8c1f240a939..0159ea5fae725 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py @@ -13,30 +13,19 @@ from ._models_py3 import AutomationRunbookReceiver from ._models_py3 import AzureAppPushReceiver from ._models_py3 import AzureFunctionReceiver -from ._models_py3 import Baseline -from ._models_py3 import BaselineMetadataValue -from ._models_py3 import BaselineResponse -from ._models_py3 import CalculateBaselineResponse -from ._models_py3 import CalculateBaselineResponseStatistics from ._models_py3 import EmailReceiver from ._models_py3 import EnableRequest from ._models_py3 import ErrorResponse from ._models_py3 import ItsmReceiver -from ._models_py3 import LocalizableString from ._models_py3 import LogicAppReceiver from ._models_py3 import Resource from ._models_py3 import SmsReceiver -from ._models_py3 import TimeSeriesInformation from ._models_py3 import VoiceReceiver from ._models_py3 import WebhookReceiver from ._monitor_management_client_enums import ( - ErrorType, - PredictionResultType, ReceiverStatus, - ResultType, - Sensitivity, ) __all__ = [ @@ -47,25 +36,14 @@ 'AutomationRunbookReceiver', 'AzureAppPushReceiver', 'AzureFunctionReceiver', - 'Baseline', - 'BaselineMetadataValue', - 'BaselineResponse', - 'CalculateBaselineResponse', - 'CalculateBaselineResponseStatistics', 'EmailReceiver', 'EnableRequest', 'ErrorResponse', 'ItsmReceiver', - 'LocalizableString', 'LogicAppReceiver', 'Resource', 'SmsReceiver', - 'TimeSeriesInformation', 'VoiceReceiver', 'WebhookReceiver', - 'ErrorType', - 'PredictionResultType', 'ReceiverStatus', - 'ResultType', - 'Sensitivity', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py index 6f09b8bfb067d..80b51029621ec 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py @@ -6,14 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * - class ActionGroupList(msrest.serialization.Model): """A list of action groups. @@ -503,337 +500,6 @@ def __init__( self.http_trigger_url = http_trigger_url -class Baseline(msrest.serialization.Model): - """The baseline values for a single sensitivity value. - - All required parameters must be populated in order to send to Azure. - - :ivar sensitivity: Required. The sensitivity of the baseline. Possible values include: "Low", - "Medium", "High". - :vartype sensitivity: str or ~$(python-base-namespace).v2018_09_01.models.Sensitivity - :ivar low_thresholds: Required. The low thresholds of the baseline. - :vartype low_thresholds: list[float] - :ivar high_thresholds: Required. The high thresholds of the baseline. - :vartype high_thresholds: list[float] - :ivar timestamps: the array of timestamps of the baselines. - :vartype timestamps: list[~datetime.datetime] - :ivar prediction_result_type: The prediction result type of the baseline. Possible values - include: 0, 1, 2. - :vartype prediction_result_type: int or - ~$(python-base-namespace).v2018_09_01.models.PredictionResultType - :ivar error_type: The error type of the baseline. Possible values include: 0, 1, 2, 3, 4, 100, - 200. - :vartype error_type: int or ~$(python-base-namespace).v2018_09_01.models.ErrorType - """ - - _validation = { - 'sensitivity': {'required': True}, - 'low_thresholds': {'required': True}, - 'high_thresholds': {'required': True}, - } - - _attribute_map = { - 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, - 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, - 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, - 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, - 'prediction_result_type': {'key': 'PredictionResultType', 'type': 'int'}, - 'error_type': {'key': 'ErrorType', 'type': 'int'}, - } - - def __init__( - self, - *, - sensitivity: Union[str, "Sensitivity"], - low_thresholds: List[float], - high_thresholds: List[float], - timestamps: Optional[List[datetime.datetime]] = None, - prediction_result_type: Optional[Union[int, "PredictionResultType"]] = None, - error_type: Optional[Union[int, "ErrorType"]] = None, - **kwargs - ): - """ - :keyword sensitivity: Required. The sensitivity of the baseline. Possible values include: - "Low", "Medium", "High". - :paramtype sensitivity: str or ~$(python-base-namespace).v2018_09_01.models.Sensitivity - :keyword low_thresholds: Required. The low thresholds of the baseline. - :paramtype low_thresholds: list[float] - :keyword high_thresholds: Required. The high thresholds of the baseline. - :paramtype high_thresholds: list[float] - :keyword timestamps: the array of timestamps of the baselines. - :paramtype timestamps: list[~datetime.datetime] - :keyword prediction_result_type: The prediction result type of the baseline. Possible values - include: 0, 1, 2. - :paramtype prediction_result_type: int or - ~$(python-base-namespace).v2018_09_01.models.PredictionResultType - :keyword error_type: The error type of the baseline. Possible values include: 0, 1, 2, 3, 4, - 100, 200. - :paramtype error_type: int or ~$(python-base-namespace).v2018_09_01.models.ErrorType - """ - super(Baseline, self).__init__(**kwargs) - self.sensitivity = sensitivity - self.low_thresholds = low_thresholds - self.high_thresholds = high_thresholds - self.timestamps = timestamps - self.prediction_result_type = prediction_result_type - self.error_type = error_type - - -class BaselineMetadataValue(msrest.serialization.Model): - """Represents a baseline metadata value. - - :ivar name: The name of the metadata. - :vartype name: ~$(python-base-namespace).v2018_09_01.models.LocalizableString - :ivar value: The value of the metadata. - :vartype value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'LocalizableString'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional["LocalizableString"] = None, - value: Optional[str] = None, - **kwargs - ): - """ - :keyword name: The name of the metadata. - :paramtype name: ~$(python-base-namespace).v2018_09_01.models.LocalizableString - :keyword value: The value of the metadata. - :paramtype value: str - """ - super(BaselineMetadataValue, self).__init__(**kwargs) - self.name = name - self.value = value - - -class BaselineResponse(msrest.serialization.Model): - """The response to a baseline query. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The metric baseline ID. - :vartype id: str - :ivar type: The resource type of the baseline resource. - :vartype type: str - :ivar name: The name and the display name of the metric, i.e. it is localizable string. - :vartype name: ~$(python-base-namespace).v2018_09_01.models.LocalizableString - :ivar timestamps: The array of timestamps of the baselines. - :vartype timestamps: list[~datetime.datetime] - :ivar baseline: The baseline values for each sensitivity. - :vartype baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] - :ivar metdata: The baseline metadata values. - :vartype metdata: list[~$(python-base-namespace).v2018_09_01.models.BaselineMetadataValue] - :ivar prediction_result_type: The prediction result type of the baseline. Possible values - include: 0, 1, 2. - :vartype prediction_result_type: int or - ~$(python-base-namespace).v2018_09_01.models.PredictionResultType - :ivar error_type: The error type of the baseline. Possible values include: 0, 1, 2, 3, 4, 100, - 200. - :vartype error_type: int or ~$(python-base-namespace).v2018_09_01.models.ErrorType - :ivar timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. - :vartype timespan: str - :ivar interval: The interval (window size) for which the metric data was returned in. This may - be adjusted in the future and returned back from what was originally requested. This is not - present if a metadata request was made. - :vartype interval: ~datetime.timedelta - :ivar aggregation: The aggregation type of the metric. - :vartype aggregation: str - :ivar internal_operation_id: internal operation id. - :vartype internal_operation_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'type': {'readonly': True}, - 'name': {'readonly': True}, - 'internal_operation_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'LocalizableString'}, - 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, - 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, - 'metdata': {'key': 'metdata', 'type': '[BaselineMetadataValue]'}, - 'prediction_result_type': {'key': 'predictionResultType', 'type': 'int'}, - 'error_type': {'key': 'errorType', 'type': 'int'}, - 'timespan': {'key': 'properties.timespan', 'type': 'str'}, - 'interval': {'key': 'properties.interval', 'type': 'duration'}, - 'aggregation': {'key': 'properties.aggregation', 'type': 'str'}, - 'internal_operation_id': {'key': 'properties.internalOperationId', 'type': 'str'}, - } - - def __init__( - self, - *, - timestamps: Optional[List[datetime.datetime]] = None, - baseline: Optional[List["Baseline"]] = None, - metdata: Optional[List["BaselineMetadataValue"]] = None, - prediction_result_type: Optional[Union[int, "PredictionResultType"]] = None, - error_type: Optional[Union[int, "ErrorType"]] = None, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - **kwargs - ): - """ - :keyword timestamps: The array of timestamps of the baselines. - :paramtype timestamps: list[~datetime.datetime] - :keyword baseline: The baseline values for each sensitivity. - :paramtype baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] - :keyword metdata: The baseline metadata values. - :paramtype metdata: list[~$(python-base-namespace).v2018_09_01.models.BaselineMetadataValue] - :keyword prediction_result_type: The prediction result type of the baseline. Possible values - include: 0, 1, 2. - :paramtype prediction_result_type: int or - ~$(python-base-namespace).v2018_09_01.models.PredictionResultType - :keyword error_type: The error type of the baseline. Possible values include: 0, 1, 2, 3, 4, - 100, 200. - :paramtype error_type: int or ~$(python-base-namespace).v2018_09_01.models.ErrorType - :keyword timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. - :paramtype timespan: str - :keyword interval: The interval (window size) for which the metric data was returned in. This - may be adjusted in the future and returned back from what was originally requested. This is - not present if a metadata request was made. - :paramtype interval: ~datetime.timedelta - :keyword aggregation: The aggregation type of the metric. - :paramtype aggregation: str - """ - super(BaselineResponse, self).__init__(**kwargs) - self.id = None - self.type = None - self.name = None - self.timestamps = timestamps - self.baseline = baseline - self.metdata = metdata - self.prediction_result_type = prediction_result_type - self.error_type = error_type - self.timespan = timespan - self.interval = interval - self.aggregation = aggregation - self.internal_operation_id = None - - -class CalculateBaselineResponse(msrest.serialization.Model): - """The response to a calculate baseline call. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The resource type of the baseline resource. - :vartype type: str - :ivar timestamps: The array of timestamps of the baselines. - :vartype timestamps: list[~datetime.datetime] - :ivar baseline: Required. The baseline values for each sensitivity. - :vartype baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] - :ivar statistics: The statistics. - :vartype statistics: - ~$(python-base-namespace).v2018_09_01.models.CalculateBaselineResponseStatistics - :ivar internal_operation_id: internal operation id. - :vartype internal_operation_id: str - :ivar error_type: The error type for calculating the baseline. Possible values include: 0, 1, - 2, 3, 4, 100, 200. - :vartype error_type: int or ~$(python-base-namespace).v2018_09_01.models.ErrorType - """ - - _validation = { - 'type': {'required': True}, - 'baseline': {'required': True}, - 'internal_operation_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, - 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, - 'statistics': {'key': 'statistics', 'type': 'CalculateBaselineResponseStatistics'}, - 'internal_operation_id': {'key': 'internalOperationId', 'type': 'str'}, - 'error_type': {'key': 'errorType', 'type': 'int'}, - } - - def __init__( - self, - *, - type: str, - baseline: List["Baseline"], - timestamps: Optional[List[datetime.datetime]] = None, - statistics: Optional["CalculateBaselineResponseStatistics"] = None, - error_type: Optional[Union[int, "ErrorType"]] = None, - **kwargs - ): - """ - :keyword type: Required. The resource type of the baseline resource. - :paramtype type: str - :keyword timestamps: The array of timestamps of the baselines. - :paramtype timestamps: list[~datetime.datetime] - :keyword baseline: Required. The baseline values for each sensitivity. - :paramtype baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] - :keyword statistics: The statistics. - :paramtype statistics: - ~$(python-base-namespace).v2018_09_01.models.CalculateBaselineResponseStatistics - :keyword error_type: The error type for calculating the baseline. Possible values include: 0, - 1, 2, 3, 4, 100, 200. - :paramtype error_type: int or ~$(python-base-namespace).v2018_09_01.models.ErrorType - """ - super(CalculateBaselineResponse, self).__init__(**kwargs) - self.type = type - self.timestamps = timestamps - self.baseline = baseline - self.statistics = statistics - self.internal_operation_id = None - self.error_type = error_type - - -class CalculateBaselineResponseStatistics(msrest.serialization.Model): - """The statistics. - - :ivar is_eligible: is series eligible for dynamic threshold analysis. - :vartype is_eligible: bool - :ivar status: The list of extended status for calculating the baseline. - :vartype status: list[str] - :ivar seasonality_period: The seasonality period for calculating the baseline. - :vartype seasonality_period: int - """ - - _attribute_map = { - 'is_eligible': {'key': 'isEligible', 'type': 'bool'}, - 'status': {'key': 'status', 'type': '[str]'}, - 'seasonality_period': {'key': 'seasonalityPeriod', 'type': 'int'}, - } - - def __init__( - self, - *, - is_eligible: Optional[bool] = None, - status: Optional[List[str]] = None, - seasonality_period: Optional[int] = None, - **kwargs - ): - """ - :keyword is_eligible: is series eligible for dynamic threshold analysis. - :paramtype is_eligible: bool - :keyword status: The list of extended status for calculating the baseline. - :paramtype status: list[str] - :keyword seasonality_period: The seasonality period for calculating the baseline. - :paramtype seasonality_period: int - """ - super(CalculateBaselineResponseStatistics, self).__init__(**kwargs) - self.is_eligible = is_eligible - self.status = status - self.seasonality_period = seasonality_period - - class EmailReceiver(msrest.serialization.Model): """An email receiver. @@ -1017,44 +683,6 @@ def __init__( self.region = region -class LocalizableString(msrest.serialization.Model): - """The localizable string class. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Required. The invariant value. - :vartype value: str - :ivar localized_value: The locale specific value. - :vartype localized_value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - *, - value: str, - localized_value: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Required. The invariant value. - :paramtype value: str - :keyword localized_value: The locale specific value. - :paramtype localized_value: str - """ - super(LocalizableString, self).__init__(**kwargs) - self.value = value - self.localized_value = localized_value - - class LogicAppReceiver(msrest.serialization.Model): """A logic app receiver. @@ -1161,52 +789,6 @@ def __init__( self.status = None -class TimeSeriesInformation(msrest.serialization.Model): - """The time series info needed for calculating the baseline. - - All required parameters must be populated in order to send to Azure. - - :ivar sensitivities: Required. The list of sensitivities for calculating the baseline. - :vartype sensitivities: list[str] - :ivar values: Required. The metric values to calculate the baseline. - :vartype values: list[float] - :ivar timestamps: The array of timestamps of the baselines. - :vartype timestamps: list[~datetime.datetime] - """ - - _validation = { - 'sensitivities': {'required': True}, - 'values': {'required': True}, - } - - _attribute_map = { - 'sensitivities': {'key': 'sensitivities', 'type': '[str]'}, - 'values': {'key': 'values', 'type': '[float]'}, - 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, - } - - def __init__( - self, - *, - sensitivities: List[str], - values: List[float], - timestamps: Optional[List[datetime.datetime]] = None, - **kwargs - ): - """ - :keyword sensitivities: Required. The list of sensitivities for calculating the baseline. - :paramtype sensitivities: list[str] - :keyword values: Required. The metric values to calculate the baseline. - :paramtype values: list[float] - :keyword timestamps: The array of timestamps of the baselines. - :paramtype timestamps: list[~datetime.datetime] - """ - super(TimeSeriesInformation, self).__init__(**kwargs) - self.sensitivities = sensitivities - self.values = values - self.timestamps = timestamps - - class VoiceReceiver(msrest.serialization.Model): """A voice receiver. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py index 200d8caf46bbf..5e8a759db49cf 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py @@ -11,26 +11,6 @@ from azure.core import CaseInsensitiveEnumMeta -class ErrorType(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): - """The error type of the baseline. - """ - - ZERO = 0 - ONE = 1 - TWO = 2 - THREE = 3 - FOUR = 4 - ONE_HUNDRED = 100 - TWO_HUNDRED = 200 - -class PredictionResultType(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): - """The prediction result type of the baseline. - """ - - ZERO = 0 - ONE = 1 - TWO = 2 - class ReceiverStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications. @@ -39,16 +19,3 @@ class ReceiverStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NOT_SPECIFIED = "NotSpecified" ENABLED = "Enabled" DISABLED = "Disabled" - -class ResultType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - - DATA = "Data" - METADATA = "Metadata" - -class Sensitivity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The sensitivity of the baseline. - """ - - LOW = "Low" - MEDIUM = "Medium" - HIGH = "High" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py index 636f48f0362a0..dc488c51fcad0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py @@ -7,11 +7,7 @@ # -------------------------------------------------------------------------- from ._action_groups_operations import ActionGroupsOperations -from ._metric_baseline_operations import MetricBaselineOperations -from ._baseline_operations import BaselineOperations __all__ = [ 'ActionGroupsOperations', - 'MetricBaselineOperations', - 'BaselineOperations', ] 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 56910bb932999..24db99154c572 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-09-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-09-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-01" + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-01" + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-09-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-09-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -189,29 +191,30 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-01" + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -221,30 +224,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-01" + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -258,35 +262,35 @@ def build_enable_receiver_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-09-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-09-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -341,6 +345,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -349,6 +354,7 @@ def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -356,7 +362,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -375,7 +385,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -402,17 +412,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -427,11 +444,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -454,17 +471,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -475,7 +499,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -505,6 +529,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -513,6 +538,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -520,7 +546,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -535,7 +565,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -551,6 +581,8 @@ def list_by_subscription_id( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -561,6 +593,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -570,6 +603,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -587,7 +621,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,7 +639,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -619,6 +657,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -630,6 +670,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -640,6 +681,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -657,7 +699,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -671,10 +717,10 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace - def enable_receiver( + def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -701,6 +747,7 @@ def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -709,6 +756,7 @@ def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -716,7 +764,11 @@ def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -727,5 +779,5 @@ def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore 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 deleted file mode 100644 index 991aea74f1e07..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py +++ /dev/null @@ -1,191 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - resource_uri: str, - *, - metricnames: Optional[str] = None, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "_models.ResultType"]] = None, - metricnamespace: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-09-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/baseline') - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - if metricnames is not None: - query_parameters['metricnames'] = _SERIALIZER.query("metricnames", metricnames, 'str') - if timespan is not None: - query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') - if interval is not None: - query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') - if aggregation is not None: - query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') - if sensitivities is not None: - query_parameters['sensitivities'] = _SERIALIZER.query("sensitivities", sensitivities, 'str') - if result_type is not None: - query_parameters['resultType'] = _SERIALIZER.query("result_type", result_type, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if metricnamespace is not None: - query_parameters['metricnamespace'] = _SERIALIZER.query("metricnamespace", metricnamespace, 'str') - if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -class BaselineOperations(object): - """BaselineOperations 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).v2018_09_01.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 - - @distributed_trace - def get( - self, - resource_uri: str, - metricnames: Optional[str] = None, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "_models.ResultType"]] = None, - metricnamespace: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> "_models.BaselineResponse": - """**Gets the baseline values for a resource**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a - metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. - :type metricnames: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. - :type interval: ~datetime.timedelta - :param aggregation: The aggregation type of the metric to retrieve the baseline for. - :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. - :type sensitivities: str - :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. - :type result_type: str or ~$(python-base-namespace).v2018_09_01.models.ResultType - :param metricnamespace: Metric namespace to query metric definitions for. - :type metricnamespace: str - :param filter: The **$filter** is used to describe a set of dimensions with their concrete - values which produce a specific metric's time series, in which a baseline is requested for. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2018_09_01.models.BaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_uri=resource_uri, - metricnames=metricnames, - timespan=timespan, - interval=interval, - aggregation=aggregation, - sensitivities=sensitivities, - result_type=result_type, - metricnamespace=metricnamespace, - filter=filter, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline'} # type: ignore - diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py deleted file mode 100644 index 100616099a953..0000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py +++ /dev/null @@ -1,289 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - resource_uri: str, - metric_name: str, - *, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "_models.ResultType"]] = None, - metricnamespace: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = "2018-09-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}') - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), - "metricName": _SERIALIZER.url("metric_name", metric_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - if timespan is not None: - query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') - if interval is not None: - query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') - if aggregation is not None: - query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') - if sensitivities is not None: - query_parameters['sensitivities'] = _SERIALIZER.query("sensitivities", sensitivities, 'str') - if result_type is not None: - query_parameters['resultType'] = _SERIALIZER.query("result_type", result_type, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if metricnamespace is not None: - query_parameters['metricnamespace'] = _SERIALIZER.query("metricnamespace", metricnamespace, 'str') - if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_calculate_baseline_request( - resource_uri: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2018-09-01" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline') - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -class MetricBaselineOperations(object): - """MetricBaselineOperations 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).v2018_09_01.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 - - @distributed_trace - def get( - self, - resource_uri: str, - metric_name: str, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - result_type: Optional[Union[str, "_models.ResultType"]] = None, - metricnamespace: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> "_models.BaselineResponse": - """**Gets the baseline values for a specific metric**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param metric_name: The name of the metric to retrieve the baseline for. - :type metric_name: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. - :type interval: ~datetime.timedelta - :param aggregation: The aggregation type of the metric to retrieve the baseline for. - :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. - :type sensitivities: str - :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. - :type result_type: str or ~$(python-base-namespace).v2018_09_01.models.ResultType - :param metricnamespace: Metric namespace to query metric definitions for. - :type metricnamespace: str - :param filter: The **$filter** is used to describe a set of dimensions with their concrete - values which produce a specific metric's time series, in which a baseline is requested for. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2018_09_01.models.BaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_uri=resource_uri, - metric_name=metric_name, - timespan=timespan, - interval=interval, - aggregation=aggregation, - sensitivities=sensitivities, - result_type=result_type, - metricnamespace=metricnamespace, - filter=filter, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore - - - @distributed_trace - def calculate_baseline( - self, - resource_uri: str, - time_series_information: "_models.TimeSeriesInformation", - **kwargs: Any - ) -> "_models.CalculateBaselineResponse": - """**Lists the baseline values for a resource**. - - :param resource_uri: The identifier of the resource. It has the following structure: - subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - For example: - subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. - :type resource_uri: str - :param time_series_information: Information that need to be specified to calculate a baseline - on a time series. - :type time_series_information: - ~$(python-base-namespace).v2018_09_01.models.TimeSeriesInformation - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CalculateBaselineResponse, or the result of cls(response) - :rtype: ~$(python-base-namespace).v2018_09_01.models.CalculateBaselineResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateBaselineResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(time_series_information, 'TimeSeriesInformation') - - request = build_calculate_baseline_request( - resource_uri=resource_uri, - content_type=content_type, - json=_json, - template_url=self.calculate_baseline.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore - diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py index 97fb7d1dca33d..3ae4f05c4eb63 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2018-11-27-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-11-27-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2018-11-27-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json index f48dd53064873..4eda122cd5ec3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py index a614ecab0d59b..88e47476d5319 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -29,8 +30,11 @@ class MonitorManagementClient: $(python-base-namespace).v2018_11_27_preview.operations.VMInsightsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-11-27-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -51,7 +55,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py index 77ea6d2eeeadb..bb21c5db7403a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2018-11-27-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-11-27-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2018-11-27-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_management_client.py index d7e018bff1c27..a1418aa0d1ecd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -29,8 +30,11 @@ class MonitorManagementClient: $(python-base-namespace).v2018_11_27_preview.aio.operations.VMInsightsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-11-27-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py index 19cbf3f37127a..c2ae123b843c1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -66,15 +65,22 @@ async def get_onboarding_status( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-11-27-preview") # type: str + request = build_get_onboarding_status_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.get_onboarding_status.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,5 +95,5 @@ async def get_onboarding_status( return deserialized - get_onboarding_status.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default'} # type: ignore + get_onboarding_status.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"} # type: ignore 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 e49f0661d35e3..954be70dc1682 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -29,29 +29,30 @@ def build_get_onboarding_status_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-11-27-preview" + api_version = kwargs.pop('api_version', "2018-11-27-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -99,15 +100,22 @@ def get_onboarding_status( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-11-27-preview") # type: str + request = build_get_onboarding_status_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.get_onboarding_status.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,5 +130,5 @@ def get_onboarding_status( return deserialized - get_onboarding_status.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default'} # type: ignore + get_onboarding_status.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py index 1040151080978..3911a9297d3db 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-03-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json index ec859da410c43..26b88ebb750ea 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py index 6c955bb8086ce..ea1d2afcd7019 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -32,8 +33,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -56,7 +60,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py index 1c02bc997da3e..e20c8250f6861 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-03-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_management_client.py index a91a75c74e1c9..e469bfe089424 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -33,8 +34,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py index 676c2e368db1b..6829dbd220c7a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -81,6 +81,7 @@ async def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,7 +112,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -134,17 +139,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,11 +171,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -186,17 +198,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -207,7 +226,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -237,6 +256,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -245,6 +265,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -252,7 +273,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,7 +292,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -283,6 +308,8 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -293,6 +320,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -302,6 +330,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -319,7 +348,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -333,7 +366,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -351,6 +384,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -362,6 +397,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -372,6 +408,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -389,7 +426,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -403,10 +444,10 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace_async - async def enable_receiver( + async def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -433,6 +474,7 @@ async def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -441,6 +483,7 @@ async def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -448,7 +491,11 @@ async def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -459,5 +506,5 @@ async def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py index d785c4ebe121f..403b8bf1e5983 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,7 +15,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -67,18 +65,21 @@ def list( :type resource_uri: str :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. + **'Metric%2Name1'**. Default value is None. :type metricnames: str - :param metricnamespace: Metric namespace to query metric definitions for. + :param metricnamespace: Metric namespace to query metric definitions for. Default value is + None. :type metricnamespace: str :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. + 'startDateTime_ISO/endDateTime_ISO'. Default value is None. :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. + :param interval: The interval (i.e. timegrain) of the query. Default value is None. :type interval: ~datetime.timedelta - :param aggregation: The list of aggregation types (comma separated) to retrieve. + :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value + is None. :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. + :param sensitivities: The list of sensitivities (comma separated) to retrieve. Default value is + None. :type sensitivities: str :param filter: The **$filter** is used to reduce the set of metric data returned. Example: Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or @@ -91,10 +92,10 @@ def list( Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim - %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. Default value is None. :type filter: str :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. + information is retrieved. Default value is None. :type result_type: str or ~$(python-base-namespace).v2019_03_01.models.ResultType :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricBaselinesResponse or the result of @@ -103,6 +104,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_03_01.models.MetricBaselinesResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricBaselinesResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -113,6 +116,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, metricnames=metricnames, metricnamespace=metricnamespace, timespan=timespan, @@ -130,6 +134,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, metricnames=metricnames, metricnamespace=metricnamespace, timespan=timespan, @@ -155,7 +160,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -169,4 +178,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricBaselines'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/metricBaselines"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py index 6c31bafc5938b..6c8ef60479dee 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -189,29 +191,30 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -221,30 +224,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -258,35 +262,35 @@ def build_enable_receiver_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -341,6 +345,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -349,6 +354,7 @@ def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -356,7 +362,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -375,7 +385,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -402,17 +412,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -427,11 +444,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -454,17 +471,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -475,7 +499,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -505,6 +529,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -513,6 +538,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -520,7 +546,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -535,7 +565,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -551,6 +581,8 @@ def list_by_subscription_id( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -561,6 +593,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -570,6 +603,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -587,7 +621,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,7 +639,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -619,6 +657,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_03_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -630,6 +670,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -640,6 +681,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -657,7 +699,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -671,10 +717,10 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace - def enable_receiver( + def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -701,6 +747,7 @@ def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -709,6 +756,7 @@ def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -716,7 +764,11 @@ def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -727,5 +779,5 @@ def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore 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 acdd6b3620b63..32c0f1ee41d99 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -17,7 +18,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,45 +40,46 @@ def build_list_request( result_type: Optional[Union[str, "_models.ResultType"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/metricBaselines') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/metricBaselines") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if metricnames is not None: - query_parameters['metricnames'] = _SERIALIZER.query("metricnames", metricnames, 'str') + _query_parameters['metricnames'] = _SERIALIZER.query("metricnames", metricnames, 'str') if metricnamespace is not None: - query_parameters['metricnamespace'] = _SERIALIZER.query("metricnamespace", metricnamespace, 'str') + _query_parameters['metricnamespace'] = _SERIALIZER.query("metricnamespace", metricnamespace, 'str') if timespan is not None: - query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') + _query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') if interval is not None: - query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') + _query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') if aggregation is not None: - query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') + _query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') if sensitivities is not None: - query_parameters['sensitivities'] = _SERIALIZER.query("sensitivities", sensitivities, 'str') + _query_parameters['sensitivities'] = _SERIALIZER.query("sensitivities", sensitivities, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if result_type is not None: - query_parameters['resultType'] = _SERIALIZER.query("result_type", result_type, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['resultType'] = _SERIALIZER.query("result_type", result_type, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -124,18 +125,21 @@ def list( :type resource_uri: str :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. + **'Metric%2Name1'**. Default value is None. :type metricnames: str - :param metricnamespace: Metric namespace to query metric definitions for. + :param metricnamespace: Metric namespace to query metric definitions for. Default value is + None. :type metricnamespace: str :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. + 'startDateTime_ISO/endDateTime_ISO'. Default value is None. :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. + :param interval: The interval (i.e. timegrain) of the query. Default value is None. :type interval: ~datetime.timedelta - :param aggregation: The list of aggregation types (comma separated) to retrieve. + :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value + is None. :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. + :param sensitivities: The list of sensitivities (comma separated) to retrieve. Default value is + None. :type sensitivities: str :param filter: The **$filter** is used to reduce the set of metric data returned. Example: Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or @@ -148,10 +152,10 @@ def list( Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim - %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. Default value is None. :type filter: str :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. + information is retrieved. Default value is None. :type result_type: str or ~$(python-base-namespace).v2019_03_01.models.ResultType :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetricBaselinesResponse or the result of @@ -160,6 +164,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_03_01.models.MetricBaselinesResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricBaselinesResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -170,6 +176,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, metricnames=metricnames, metricnamespace=metricnamespace, timespan=timespan, @@ -187,6 +194,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, metricnames=metricnames, metricnamespace=metricnamespace, timespan=timespan, @@ -212,7 +220,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -226,4 +238,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricBaselines'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/metricBaselines"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py index fd3c7aceb873a..a6860e42c01cd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json index 86800ff33772a..775abfe44986d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py index 07d73bf58d4aa..f2e4a578da761 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -30,8 +31,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -53,7 +57,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py index bbcc96275adc7..10763f7712268 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_management_client.py index 49caf9f19a615..1ed5342d3df06 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py index 8c4ea96238766..ad3d9d0eb227d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -81,6 +81,7 @@ async def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,7 +112,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -134,17 +139,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,11 +171,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -186,17 +198,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -207,7 +226,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -237,6 +256,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -245,6 +265,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -252,7 +273,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,7 +292,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -283,6 +308,8 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_06_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -293,6 +320,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -302,6 +330,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -319,7 +348,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -333,7 +366,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -351,6 +384,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_06_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -362,6 +397,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -372,6 +408,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -389,7 +426,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -403,10 +444,10 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace_async - async def enable_receiver( + async def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -433,6 +474,7 @@ async def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -441,6 +483,7 @@ async def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -448,7 +491,11 @@ async def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -459,5 +506,5 @@ async def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore 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 95eedacf8e7cc..2e6c85f54ec8b 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-06-01" + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-06-01" + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -189,29 +191,30 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-06-01" + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -221,30 +224,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-06-01" + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -258,35 +262,35 @@ def build_enable_receiver_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -341,6 +345,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -349,6 +354,7 @@ def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -356,7 +362,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -375,7 +385,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -402,17 +412,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -427,11 +444,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -454,17 +471,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -475,7 +499,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -505,6 +529,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -513,6 +538,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -520,7 +546,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -535,7 +565,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -551,6 +581,8 @@ def list_by_subscription_id( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_06_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -561,6 +593,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -570,6 +603,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -587,7 +621,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,7 +639,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -619,6 +657,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_06_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -630,6 +670,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -640,6 +681,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -657,7 +699,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -671,10 +717,10 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups"} # type: ignore @distributed_trace - def enable_receiver( + def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -701,6 +747,7 @@ def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -709,6 +756,7 @@ def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -716,7 +764,11 @@ def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 409]: @@ -727,5 +779,5 @@ def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py index ba079fc9b32ad..2df221ca96ffd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-10-17-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-10-17-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json index c1ab582041420..a393daf1dc400 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_management_client.py index 7ec772089c38a..1bcc059e1e4d5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -43,8 +44,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-10-17-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -72,7 +76,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py index 26c8b9416b5db..c41ed063f8671 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-10-17-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-10-17-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_management_client.py index 33dce3625e851..e713c76ebd2b5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -43,8 +44,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-10-17-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py index 33fca8708f692..3f645fd789447 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -75,18 +74,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,7 +106,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _create_or_update_initial( @@ -117,6 +123,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -126,6 +133,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -133,7 +141,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -149,7 +161,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -185,8 +197,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -199,6 +212,7 @@ async def begin_create_or_update( scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -223,12 +237,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -241,18 +254,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -262,11 +282,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -293,7 +313,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -305,6 +326,7 @@ async def begin_delete( resource_group_name=resource_group_name, scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -325,10 +347,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_by_private_link_scope( @@ -350,6 +371,8 @@ def list_by_private_link_scope( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -362,6 +385,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=self.list_by_private_link_scope.metadata['url'], ) request = _convert_request(request) @@ -373,6 +397,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -390,7 +415,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -403,4 +432,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections'} # type: ignore + list_by_private_link_scope.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py index 4883f725b4392..eeaf87b5391d6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -66,6 +65,8 @@ def list_by_private_link_scope( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -78,6 +79,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=self.list_by_private_link_scope.metadata['url'], ) request = _convert_request(request) @@ -89,6 +91,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -106,7 +109,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -119,7 +126,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources'} # type: ignore + list_by_private_link_scope.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources"} # type: ignore @distributed_trace_async async def get( @@ -148,18 +155,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, group_name=group_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -173,5 +187,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py index 722da8748b6be..6c4530840dcda 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -69,17 +68,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( async_operation_id=async_operation_id, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,5 +99,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py index b7a1d087b4410..9e43709d2d9f2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -75,18 +74,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,7 +106,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore async def _create_or_update_initial( @@ -117,6 +123,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ScopedResource') @@ -126,6 +133,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, scope_name=scope_name, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -133,7 +141,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -152,7 +164,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore @distributed_trace_async @@ -188,8 +200,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~$(python-base-namespace).v2019_10_17.models.ScopedResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -202,6 +215,7 @@ async def begin_create_or_update( scope_name=scope_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -226,12 +240,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -244,18 +257,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, name=name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -265,11 +285,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -296,7 +316,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -308,6 +329,7 @@ async def begin_delete( resource_group_name=resource_group_name, scope_name=scope_name, name=name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -328,10 +350,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore @distributed_trace def list_by_private_link_scope( @@ -353,6 +374,8 @@ def list_by_private_link_scope( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.ScopedResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -365,6 +388,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=self.list_by_private_link_scope.metadata['url'], ) request = _convert_request(request) @@ -376,6 +400,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -393,7 +418,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -406,4 +435,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources'} # type: ignore + list_by_private_link_scope.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py index e0e17418bd24d..b614b5c7f10c0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -62,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScopeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -72,6 +73,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -81,6 +83,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -98,7 +101,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +118,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes"} # type: ignore @distributed_trace def list_by_resource_group( @@ -130,6 +137,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScopeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -141,6 +150,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -151,6 +161,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -168,7 +179,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -181,9 +196,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -195,17 +210,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, scope_name=scope_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -215,11 +237,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -243,7 +265,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -254,6 +277,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -274,10 +298,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore @distributed_trace_async async def get( @@ -303,17 +326,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, scope_name=scope_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,7 +357,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore @distributed_trace_async @@ -360,6 +390,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(azure_monitor_private_link_scope_payload, 'AzureMonitorPrivateLinkScope') @@ -368,6 +399,7 @@ async def create_or_update( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, scope_name=scope_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -375,7 +407,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -393,7 +429,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore @distributed_trace_async @@ -425,6 +461,7 @@ async def update_tags( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_link_scope_tags, 'TagsResource') @@ -433,6 +470,7 @@ async def update_tags( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, scope_name=scope_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], @@ -440,7 +478,11 @@ async def update_tags( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -454,5 +496,5 @@ async def update_tags( return deserialized - update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore 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 564be0f4fcd09..0a5175cf8623f 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -47,21 +48,21 @@ def build_get_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -76,12 +77,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-10-17-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -89,23 +90,23 @@ def build_create_or_update_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -119,9 +120,10 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -129,16 +131,16 @@ def build_delete_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, + url=_url, + params=_query_parameters, **kwargs ) @@ -149,31 +151,32 @@ def build_list_by_private_link_scope_request( scope_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "scopeName": _SERIALIZER.url("scope_name", scope_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -226,18 +229,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -251,7 +261,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _create_or_update_initial( @@ -268,6 +278,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -277,6 +288,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -284,7 +296,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -300,7 +316,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -336,8 +352,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -350,6 +367,7 @@ def begin_create_or_update( scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -374,12 +392,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -392,18 +409,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -413,11 +437,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -444,7 +468,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -456,6 +481,7 @@ def begin_delete( resource_group_name=resource_group_name, scope_name=scope_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -476,10 +502,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_by_private_link_scope( @@ -501,6 +526,8 @@ def list_by_private_link_scope( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -513,6 +540,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=self.list_by_private_link_scope.metadata['url'], ) request = _convert_request(request) @@ -524,6 +552,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -541,7 +570,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -554,4 +587,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections'} # type: ignore + list_by_private_link_scope.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections"} # type: ignore 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 d24fddbe40134..e0fc344e63a3c 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_list_by_private_link_scope_request( scope_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "scopeName": _SERIALIZER.url("scope_name", scope_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,10 +69,11 @@ def build_get_request( group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -79,21 +81,21 @@ def build_get_request( "groupName": _SERIALIZER.url("group_name", group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -139,6 +141,8 @@ def list_by_private_link_scope( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -151,6 +155,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=self.list_by_private_link_scope.metadata['url'], ) request = _convert_request(request) @@ -162,6 +167,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -179,7 +185,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -192,7 +202,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources'} # type: ignore + list_by_private_link_scope.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources"} # type: ignore @distributed_trace def get( @@ -221,18 +231,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, group_name=group_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -246,5 +263,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}"} # type: ignore 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 10d19919d2a14..c05a53ba18f41 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,31 +31,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}") # pylint: disable=line-too-long path_format_arguments = { "asyncOperationId": _SERIALIZER.url("async_operation_id", async_operation_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -106,17 +107,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( async_operation_id=async_operation_id, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,5 +138,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}"} # type: ignore 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 29ef35a608dfb..399252c0f0155 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -47,21 +48,21 @@ def build_get_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -76,12 +77,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-10-17-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -89,23 +90,23 @@ def build_create_or_update_request_initial( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -119,9 +120,10 @@ def build_delete_request_initial( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -129,16 +131,16 @@ def build_delete_request_initial( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, + url=_url, + params=_query_parameters, **kwargs ) @@ -149,31 +151,32 @@ def build_list_by_private_link_scope_request( scope_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "scopeName": _SERIALIZER.url("scope_name", scope_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -226,18 +229,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -251,7 +261,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore def _create_or_update_initial( @@ -268,6 +278,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ScopedResource') @@ -277,6 +288,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, scope_name=scope_name, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -284,7 +296,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -303,7 +319,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore @distributed_trace @@ -339,8 +355,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~$(python-base-namespace).v2019_10_17.models.ScopedResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -353,6 +370,7 @@ def begin_create_or_update( scope_name=scope_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -377,12 +395,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -395,18 +412,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, name=name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -416,11 +440,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -447,7 +471,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -459,6 +484,7 @@ def begin_delete( resource_group_name=resource_group_name, scope_name=scope_name, name=name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -479,10 +505,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"} # type: ignore @distributed_trace def list_by_private_link_scope( @@ -504,6 +529,8 @@ def list_by_private_link_scope( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.ScopedResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopedResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -516,6 +543,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=self.list_by_private_link_scope.metadata['url'], ) request = _convert_request(request) @@ -527,6 +555,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -544,7 +573,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -557,4 +590,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources'} # type: ignore + list_by_private_link_scope.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources"} # type: ignore 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 1679732ffcaef..d106ac5b57e04 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,29 +33,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,30 +66,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -99,25 +101,26 @@ def build_delete_request_initial( scope_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "scopeName": _SERIALIZER.url("scope_name", scope_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, + url=_url, + params=_query_parameters, **kwargs ) @@ -128,31 +131,32 @@ def build_get_request( scope_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-10-17-preview" + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "scopeName": _SERIALIZER.url("scope_name", scope_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,35 +170,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-10-17-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "scopeName": _SERIALIZER.url("scope_name", scope_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -210,35 +214,35 @@ def build_update_tags_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-10-17-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "scopeName": _SERIALIZER.url("scope_name", scope_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -280,6 +284,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScopeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +296,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -299,6 +306,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -316,7 +324,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -329,7 +341,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes"} # type: ignore @distributed_trace def list_by_resource_group( @@ -348,6 +360,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_10_17.models.AzureMonitorPrivateLinkScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorPrivateLinkScopeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -359,6 +373,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -369,6 +384,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -386,7 +402,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -399,9 +419,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -413,17 +433,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, scope_name=scope_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -433,11 +460,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scope_name: str, @@ -461,7 +488,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +500,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, scope_name=scope_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -492,10 +521,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore @distributed_trace def get( @@ -521,17 +549,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str + request = build_get_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, scope_name=scope_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -545,7 +580,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore @distributed_trace @@ -578,6 +613,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(azure_monitor_private_link_scope_payload, 'AzureMonitorPrivateLinkScope') @@ -586,6 +622,7 @@ def create_or_update( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, scope_name=scope_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -593,7 +630,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -611,7 +652,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore @distributed_trace @@ -643,6 +684,7 @@ def update_tags( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-10-17-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_link_scope_tags, 'TagsResource') @@ -651,6 +693,7 @@ def update_tags( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, scope_name=scope_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], @@ -658,7 +701,11 @@ def update_tags( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -672,5 +719,5 @@ def update_tags( return deserialized - update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}'} # type: ignore + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py index 3976d687afde4..df9da9ebbfee7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-11-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json index 34885a43497c6..c230b21e7154c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_management_client.py index 3c59bcc99068d..4ca63bf7e8b46 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -34,8 +35,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -58,7 +62,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py index 2dc886a8a1f4f..8e0896e554e05 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-11-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_management_client.py index ea9134b6ffef9..0ba6ee8a7c7c0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -34,8 +35,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py index d7bca3542c6d7..af6ee9f93a4ab 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -65,6 +64,8 @@ def list_by_resource( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +76,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list_by_resource.metadata['url'], ) request = _convert_request(request) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,7 +104,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,7 +122,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + list_by_resource.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations"} # type: ignore @distributed_trace def list_by_rule( @@ -140,6 +147,8 @@ def list_by_rule( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -152,6 +161,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.list_by_rule.metadata['url'], ) request = _convert_request(request) @@ -163,6 +173,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -180,7 +191,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -194,7 +209,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + list_by_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations"} # type: ignore @distributed_trace_async async def get( @@ -223,16 +238,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,7 +269,7 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace_async @@ -266,7 +288,7 @@ async def create( :type resource_uri: str :param association_name: The name of the association. The name is case insensitive. :type association_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource :keyword callable cls: A custom type or function that will be passed the direct response @@ -281,6 +303,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -291,6 +314,7 @@ async def create( request = build_create_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -298,7 +322,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -317,11 +345,11 @@ async def create( return deserialized - create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + create.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, association_name: str, @@ -346,16 +374,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -366,5 +401,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py index c080414315049..7fdce2fa19b19 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -65,6 +64,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,7 +106,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,7 +124,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace def list_by_subscription( @@ -135,6 +142,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -145,6 +154,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -154,6 +164,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -171,7 +182,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,7 +200,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace_async async def get( @@ -214,17 +229,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,7 +261,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace_async @@ -259,7 +281,7 @@ async def create( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -272,6 +294,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -283,6 +306,7 @@ async def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -290,7 +314,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -309,7 +337,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace_async @@ -329,7 +357,7 @@ async def update( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2019_11_01_preview.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -342,6 +370,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -353,6 +382,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -360,7 +390,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -375,11 +409,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_rule_name: str, @@ -405,17 +439,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -426,5 +467,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py index 2a0854de768ad..93b97b1a32c1b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_resource_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01-preview" + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,31 +65,32 @@ def build_list_by_rule_request( data_collection_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01-preview" + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,30 +100,31 @@ def build_get_request( association_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01-preview" + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -134,34 +137,34 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -173,30 +176,31 @@ def build_delete_request( association_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01-preview" + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -241,6 +245,8 @@ def list_by_resource( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -251,6 +257,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list_by_resource.metadata['url'], ) request = _convert_request(request) @@ -260,6 +267,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -277,7 +285,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -291,7 +303,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + list_by_resource.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations"} # type: ignore @distributed_trace def list_by_rule( @@ -316,6 +328,8 @@ def list_by_rule( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -328,6 +342,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.list_by_rule.metadata['url'], ) request = _convert_request(request) @@ -339,6 +354,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -356,7 +372,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -370,7 +390,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + list_by_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations"} # type: ignore @distributed_trace def get( @@ -399,16 +419,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -423,7 +450,7 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace @@ -442,7 +469,7 @@ def create( :type resource_uri: str :param association_name: The name of the association. The name is case insensitive. :type association_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource :keyword callable cls: A custom type or function that will be passed the direct response @@ -457,6 +484,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -467,6 +495,7 @@ def create( request = build_create_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -474,7 +503,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -493,11 +526,11 @@ def create( return deserialized - create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + create.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, association_name: str, @@ -522,16 +555,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -542,5 +582,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py index e7390a1641763..0d4078978cfb4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01-preview" + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,29 +65,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01-preview" + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,31 +99,32 @@ def build_get_request( data_collection_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01-preview" + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,35 +138,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -179,35 +182,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -220,31 +223,32 @@ def build_delete_request( data_collection_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01-preview" + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -289,6 +293,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -300,6 +306,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -310,6 +317,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -327,7 +335,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -341,7 +353,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace def list_by_subscription( @@ -359,6 +371,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -369,6 +383,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -378,6 +393,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -395,7 +411,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,7 +429,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace def get( @@ -438,17 +458,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -463,7 +490,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace @@ -483,7 +510,7 @@ def create( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -496,6 +523,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -507,6 +535,7 @@ def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -514,7 +543,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -533,7 +566,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace @@ -553,7 +586,7 @@ def update( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2019_11_01_preview.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -566,6 +599,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -577,6 +611,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -584,7 +619,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,11 +638,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_rule_name: str, @@ -629,17 +668,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -650,5 +696,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py index a3b6df71aadbc..24ef9950ab69f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2020-01-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2020-01-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**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 index 378468ef8a93e..b9c51d72cb602 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py index c96780028635d..a38608eff2686 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -30,8 +31,11 @@ class MonitorManagementClient: $(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 base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-01-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -52,7 +56,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py index cdef221ece0b6..41d28e9db87f6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,6 +27,9 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2020-01-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,11 +38,13 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.api_version = "2020-01-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_management_client.py index 8c3c52b5455bb..7ac4578f99ae6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -30,8 +31,11 @@ class MonitorManagementClient: $(python-base-namespace).v2020_01_01_preview.aio.operations.ManagementGroupDiagnosticSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-01-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py index 921396e02fe26..b42fc0fdafa90 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -71,16 +70,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + request = build_get_request( management_group_id=management_group_id, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -95,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async @@ -127,6 +133,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ManagementGroupDiagnosticSettingsResource') @@ -134,6 +141,7 @@ async def create_or_update( request = build_create_or_update_request( management_group_id=management_group_id, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -141,7 +149,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -156,11 +168,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, management_group_id: str, name: str, @@ -183,16 +195,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + request = build_delete_request( management_group_id=management_group_id, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -203,7 +222,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -223,6 +242,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -233,6 +254,7 @@ def prepare_request(next_link=None): request = build_list_request( management_group_id=management_group_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -242,6 +264,7 @@ def prepare_request(next_link=None): request = build_list_request( management_group_id=management_group_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -259,7 +282,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -273,4 +300,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings'} # type: ignore + 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/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py index 9c127025109b2..ce18fb10c2cb6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-01-01-preview" + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,34 +69,34 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-01-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -107,30 +108,31 @@ def build_delete_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-01-01-preview" + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -139,29 +141,30 @@ def build_list_request( management_group_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-01-01-preview" + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings') + _url = kwargs.pop("template_url", "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings") # pylint: disable=line-too-long path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -212,16 +215,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + request = build_get_request( management_group_id=management_group_id, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -236,7 +246,7 @@ def get( return deserialized - get.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -268,6 +278,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ManagementGroupDiagnosticSettingsResource') @@ -275,6 +286,7 @@ def create_or_update( request = build_create_or_update_request( management_group_id=management_group_id, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -282,7 +294,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -297,11 +313,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, management_group_id: str, name: str, @@ -324,16 +340,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + request = build_delete_request( management_group_id=management_group_id, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,7 +367,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -364,6 +387,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -374,6 +399,7 @@ def prepare_request(next_link=None): request = build_list_request( management_group_id=management_group_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -383,6 +409,7 @@ def prepare_request(next_link=None): request = build_list_request( management_group_id=management_group_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -400,7 +427,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -414,4 +445,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings'} # type: ignore + 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_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py index 5e7e4b72cc0a3..ae668e8ace760 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-05-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json index 0518924e3fa38..7709ce6d006e5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_management_client.py index fa5afc6020a9a..5affad502f4b3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -54,7 +58,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py index 9542d1ff846f5..e33b0619cb1cf 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-05-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_management_client.py index 62e082f8affdb..98a4b82229ce1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py index 8e128c253a04e..9a98186478185 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -60,6 +59,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -70,6 +71,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -79,6 +81,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -96,7 +99,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules"} # type: ignore @distributed_trace def list_by_resource_group( @@ -129,6 +136,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -140,6 +149,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -150,6 +160,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -167,7 +178,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -181,7 +196,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules"} # type: ignore @distributed_trace_async async def get( @@ -207,17 +222,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -232,7 +254,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace_async @@ -263,6 +285,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ScheduledQueryRuleResource') @@ -271,6 +294,7 @@ async def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -278,7 +302,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -297,7 +325,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace_async @@ -328,6 +356,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ScheduledQueryRuleResourcePatch') @@ -336,6 +365,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -343,7 +373,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -358,11 +392,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -385,17 +419,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -406,5 +447,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py index 3da1f29e37d61..d5358d8e87c3d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01-preview" + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +64,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01-preview" + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,31 +99,32 @@ def build_get_request( rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01-preview" + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,35 +138,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -179,35 +182,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -220,31 +223,32 @@ def build_delete_request( rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01-preview" + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -284,6 +288,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -294,6 +300,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -303,6 +310,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -320,7 +328,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -334,7 +346,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules"} # type: ignore @distributed_trace def list_by_resource_group( @@ -353,6 +365,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +378,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -374,6 +389,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -391,7 +407,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,7 +425,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules"} # type: ignore @distributed_trace def get( @@ -431,17 +451,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -456,7 +483,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace @@ -487,6 +514,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ScheduledQueryRuleResource') @@ -495,6 +523,7 @@ def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -502,7 +531,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -521,7 +554,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace @@ -552,6 +585,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ScheduledQueryRuleResourcePatch') @@ -560,6 +594,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -567,7 +602,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -582,11 +621,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, @@ -609,17 +648,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, rule_name=rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -630,5 +676,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_configuration.py index 14af962330334..22f6bfab97724 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-10-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_metadata.json index f1fae9dab9581..84588921906b9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_monitor_management_client.py index 694355cab0288..b90619b2771c2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -54,7 +58,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_configuration.py index d463a021089f0..55911295e09b0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-10-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_monitor_management_client.py index 6f8d6651909b9..0eb340b01848a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/_activity_log_alerts_operations.py index 08ed28f3b920d..09a7cf3ccdc8f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/_activity_log_alerts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -74,6 +73,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert_rule, 'ActivityLogAlertResource') @@ -82,6 +82,7 @@ async def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -89,7 +90,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -108,7 +113,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace_async @@ -135,17 +140,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -160,11 +172,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, activity_log_alert_name: str, @@ -187,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -208,7 +227,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace_async @@ -241,6 +260,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert_rule_patch, 'AlertRulePatchObject') @@ -249,6 +269,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -256,7 +277,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -271,7 +296,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -287,6 +312,8 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_10_01.models.AlertRuleList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -297,6 +324,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -306,6 +334,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -323,7 +352,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -337,7 +370,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -355,6 +388,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_10_01.models.AlertRuleList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -366,6 +401,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -376,6 +412,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -393,7 +430,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,4 +448,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/_activity_log_alerts_operations.py index fc2181da2fc5f..64fa4f045f2fb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/_activity_log_alerts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_get_request( activity_log_alert_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01" + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_delete_request( activity_log_alert_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01" + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,35 +152,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -189,29 +191,30 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01" + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -221,30 +224,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01" + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -298,6 +302,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert_rule, 'ActivityLogAlertResource') @@ -306,6 +311,7 @@ def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -313,7 +319,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -332,7 +342,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -359,17 +369,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -384,11 +401,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, activity_log_alert_name: str, @@ -411,17 +428,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -432,7 +456,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -465,6 +489,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(activity_log_alert_rule_patch, 'AlertRulePatchObject') @@ -473,6 +498,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, activity_log_alert_name=activity_log_alert_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -480,7 +506,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -495,7 +525,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}"} # type: ignore @distributed_trace @@ -511,6 +541,8 @@ def list_by_subscription_id( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_10_01.models.AlertRuleList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -521,6 +553,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -530,6 +563,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -547,7 +581,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -561,7 +599,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -579,6 +617,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_10_01.models.AlertRuleList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -590,6 +630,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -600,6 +641,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -617,7 +659,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -631,4 +677,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_configuration.py index 030a5ba894ea3..984c882491415 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-04-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_metadata.json index b089e37d50b56..c36a245f3f252 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_monitor_management_client.py index 84dc1ddcca183..75f551e72f8aa 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -37,8 +38,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -62,7 +66,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_configuration.py index 457603f1e0013..b4586432cdb20 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-04-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_monitor_management_client.py index cc25115a9967c..2b0906523f64d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -37,8 +38,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_endpoints_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_endpoints_operations.py index dc284b81446b4..ab8c4b62f88cd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_endpoints_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_endpoints_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -65,6 +64,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,7 +106,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,7 +124,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints"} # type: ignore @distributed_trace def list_by_subscription( @@ -135,6 +142,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -145,6 +154,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -154,6 +164,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -171,7 +182,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,7 +200,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints"} # type: ignore @distributed_trace_async async def get( @@ -214,17 +229,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,7 +261,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace_async @@ -259,7 +281,7 @@ async def create( :param data_collection_endpoint_name: The name of the data collection endpoint. The name is case insensitive. :type data_collection_endpoint_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionEndpointResource, or the result of cls(response) @@ -272,6 +294,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -283,6 +306,7 @@ async def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -290,7 +314,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -309,7 +337,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace_async @@ -329,7 +357,7 @@ async def update( :param data_collection_endpoint_name: The name of the data collection endpoint. The name is case insensitive. :type data_collection_endpoint_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionEndpointResource, or the result of cls(response) @@ -342,6 +370,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -353,6 +382,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -360,7 +390,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -375,11 +409,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_endpoint_name: str, @@ -405,17 +439,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -426,5 +467,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rule_associations_operations.py index 3492b8a74d5d8..b27070d3d0b7c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rule_associations_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rule_associations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -65,6 +64,8 @@ def list_by_resource( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +76,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list_by_resource.metadata['url'], ) request = _convert_request(request) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,7 +104,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,7 +122,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + list_by_resource.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations"} # type: ignore @distributed_trace def list_by_rule( @@ -140,6 +147,8 @@ def list_by_rule( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -152,6 +161,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.list_by_rule.metadata['url'], ) request = _convert_request(request) @@ -163,6 +173,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -180,7 +191,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -194,7 +209,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + list_by_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations"} # type: ignore @distributed_trace_async async def get( @@ -223,16 +238,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,7 +269,7 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace_async @@ -266,7 +288,7 @@ async def create( :type resource_uri: str :param association_name: The name of the association. The name is case insensitive. :type association_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource :keyword callable cls: A custom type or function that will be passed the direct response @@ -281,6 +303,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -291,6 +314,7 @@ async def create( request = build_create_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -298,7 +322,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -317,11 +345,11 @@ async def create( return deserialized - create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + create.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, association_name: str, @@ -346,16 +374,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -366,5 +401,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rules_operations.py index f888346fcd12b..ba41876e6329a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -65,6 +64,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,7 +106,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,7 +124,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace def list_by_subscription( @@ -135,6 +142,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -145,6 +154,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -154,6 +164,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -171,7 +182,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,7 +200,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace_async async def get( @@ -214,17 +229,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,7 +261,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace_async @@ -259,7 +281,7 @@ async def create( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -272,6 +294,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -283,6 +306,7 @@ async def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -290,7 +314,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -309,7 +337,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace_async @@ -329,7 +357,7 @@ async def update( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -342,6 +370,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -353,6 +382,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -360,7 +390,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -375,11 +409,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_rule_name: str, @@ -405,17 +439,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -426,5 +467,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_endpoints_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_endpoints_operations.py index e08e17d35616e..90cd704d6cbe3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_endpoints_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_endpoints_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,29 +65,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,31 +99,32 @@ def build_get_request( data_collection_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionEndpointName": _SERIALIZER.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,35 +138,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionEndpointName": _SERIALIZER.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -179,35 +182,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionEndpointName": _SERIALIZER.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -220,31 +223,32 @@ def build_delete_request( data_collection_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionEndpointName": _SERIALIZER.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -289,6 +293,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -300,6 +306,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -310,6 +317,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -327,7 +335,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -341,7 +353,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints"} # type: ignore @distributed_trace def list_by_subscription( @@ -359,6 +371,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -369,6 +383,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -378,6 +393,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -395,7 +411,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,7 +429,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints"} # type: ignore @distributed_trace def get( @@ -438,17 +458,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -463,7 +490,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace @@ -483,7 +510,7 @@ def create( :param data_collection_endpoint_name: The name of the data collection endpoint. The name is case insensitive. :type data_collection_endpoint_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionEndpointResource, or the result of cls(response) @@ -496,6 +523,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -507,6 +535,7 @@ def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -514,7 +543,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -533,7 +566,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace @@ -553,7 +586,7 @@ def update( :param data_collection_endpoint_name: The name of the data collection endpoint. The name is case insensitive. :type data_collection_endpoint_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionEndpointResource, or the result of cls(response) @@ -566,6 +599,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -577,6 +611,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -584,7 +619,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,11 +638,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_endpoint_name: str, @@ -629,17 +668,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -650,5 +696,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rule_associations_operations.py index 9f0103c4e7f2f..495fd7b8eacb6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rule_associations_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rule_associations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_resource_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,31 +65,32 @@ def build_list_by_rule_request( data_collection_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,30 +100,31 @@ def build_get_request( association_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -134,34 +137,34 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -173,30 +176,31 @@ def build_delete_request( association_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -241,6 +245,8 @@ def list_by_resource( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -251,6 +257,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list_by_resource.metadata['url'], ) request = _convert_request(request) @@ -260,6 +267,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -277,7 +285,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -291,7 +303,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + list_by_resource.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations"} # type: ignore @distributed_trace def list_by_rule( @@ -316,6 +328,8 @@ def list_by_rule( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -328,6 +342,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.list_by_rule.metadata['url'], ) request = _convert_request(request) @@ -339,6 +354,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -356,7 +372,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -370,7 +390,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + list_by_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations"} # type: ignore @distributed_trace def get( @@ -399,16 +419,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -423,7 +450,7 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace @@ -442,7 +469,7 @@ def create( :type resource_uri: str :param association_name: The name of the association. The name is case insensitive. :type association_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource :keyword callable cls: A custom type or function that will be passed the direct response @@ -457,6 +484,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -467,6 +495,7 @@ def create( request = build_create_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -474,7 +503,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -493,11 +526,11 @@ def create( return deserialized - create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + create.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, association_name: str, @@ -522,16 +555,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -542,5 +582,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rules_operations.py index f9ee7485f2739..08be9ac3fa487 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,29 +65,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,31 +99,32 @@ def build_get_request( data_collection_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,35 +138,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -179,35 +182,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -220,31 +223,32 @@ def build_delete_request( data_collection_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -289,6 +293,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -300,6 +306,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -310,6 +317,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -327,7 +335,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -341,7 +353,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace def list_by_subscription( @@ -359,6 +371,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -369,6 +383,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -378,6 +393,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -395,7 +411,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,7 +429,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace def get( @@ -438,17 +458,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -463,7 +490,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace @@ -483,7 +510,7 @@ def create( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -496,6 +523,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -507,6 +535,7 @@ def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -514,7 +543,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -533,7 +566,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace @@ -553,7 +586,7 @@ def update( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2021_04_01.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -566,6 +599,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -577,6 +611,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -584,7 +619,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,11 +638,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_rule_name: str, @@ -629,17 +668,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -650,5 +696,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_configuration.py index daa1eaa37dbea..8762b312b1349 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-05-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_metadata.json index 3feeaec00b538..fff5210069649 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_monitor_management_client.py index 519c5ba60fc2e..fb81f64a13c26 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -47,8 +48,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -75,7 +79,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_configuration.py index 7da2da7519122..11ff51a080fe2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-05-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_monitor_management_client.py index 1024edbc3147e..d45c3f6ddca21 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -47,8 +48,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_autoscale_settings_operations.py index 7aa783a2f7138..2734708c80ea6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_autoscale_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_autoscale_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -63,6 +62,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +75,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,7 +104,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,7 +122,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings"} # type: ignore @distributed_trace_async async def create_or_update( @@ -144,6 +151,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AutoscaleSettingResource') @@ -152,6 +160,7 @@ async def create_or_update( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -159,7 +168,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -178,11 +191,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, autoscale_setting_name: str, @@ -205,17 +218,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_delete_request( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -226,7 +246,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace_async @@ -253,17 +273,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -278,7 +305,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace_async @@ -310,6 +337,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(autoscale_setting_resource, 'AutoscaleSettingResourcePatch') @@ -318,6 +346,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -325,7 +354,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -340,7 +373,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace @@ -357,6 +390,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -367,6 +402,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -376,6 +412,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -393,7 +430,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,4 +448,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py index 2caa5d0120dd0..4b304e483db5d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -70,16 +69,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -94,7 +100,7 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}"} # type: ignore @distributed_trace @@ -114,6 +120,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsCategoryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -124,6 +132,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -133,6 +142,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -150,7 +160,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -164,4 +178,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_operations.py index 3d65ad45bfed4..81c477d46af47 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -70,16 +69,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -94,7 +100,7 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async @@ -125,6 +131,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DiagnosticSettingsResource') @@ -132,6 +139,7 @@ async def create_or_update( request = build_create_or_update_request( resource_uri=resource_uri, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -139,7 +147,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -154,11 +166,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, name: str, @@ -181,16 +193,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -201,7 +220,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -221,6 +240,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -231,6 +252,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -240,6 +262,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -257,7 +280,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -271,4 +298,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py index bcbdf01076582..58ce1e50b3d76 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -71,16 +70,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( management_group_id=management_group_id, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -95,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async @@ -127,6 +133,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ManagementGroupDiagnosticSettingsResource') @@ -134,6 +141,7 @@ async def create_or_update( request = build_create_or_update_request( management_group_id=management_group_id, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -141,7 +149,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -156,11 +168,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, management_group_id: str, name: str, @@ -183,16 +195,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_delete_request( management_group_id=management_group_id, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -203,7 +222,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -223,6 +242,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -233,6 +254,7 @@ def prepare_request(next_link=None): request = build_list_request( management_group_id=management_group_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -242,6 +264,7 @@ def prepare_request(next_link=None): request = build_list_request( management_group_id=management_group_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -259,7 +282,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -273,4 +300,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore + 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/v2021_05_01_preview/aio/operations/_predictive_metric_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_predictive_metric_operations.py index a3ad60180b574..ecb1d40381662 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_predictive_metric_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_predictive_metric_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -87,11 +86,14 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, + api_version=api_version, timespan=timespan, interval=interval, metric_namespace=metric_namespace, @@ -102,7 +104,11 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,5 +123,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py index 8dff60bc58a4d..037c474eb5bc4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -68,16 +67,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,7 +98,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async @@ -121,6 +127,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SubscriptionDiagnosticSettingsResource') @@ -128,6 +135,7 @@ async def create_or_update( request = build_create_or_update_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -135,7 +143,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -150,11 +162,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, name: str, **kwargs: Any @@ -174,16 +186,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -194,7 +213,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -211,6 +230,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -221,6 +242,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -230,6 +252,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -247,7 +270,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -261,4 +288,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_autoscale_settings_operations.py index 20f822ebc8509..d450724714f45 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_autoscale_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_autoscale_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -69,35 +70,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-05-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -110,31 +111,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -145,31 +147,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,35 +186,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-05-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -222,29 +225,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -287,6 +291,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -298,6 +304,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -308,6 +315,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -325,7 +333,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -339,7 +351,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings"} # type: ignore @distributed_trace def create_or_update( @@ -368,6 +380,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AutoscaleSettingResource') @@ -376,6 +389,7 @@ def create_or_update( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -383,7 +397,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -402,11 +420,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, autoscale_setting_name: str, @@ -429,17 +447,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_delete_request( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -450,7 +475,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace @@ -477,17 +502,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -502,7 +534,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace @@ -534,6 +566,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(autoscale_setting_resource, 'AutoscaleSettingResourcePatch') @@ -542,6 +575,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -549,7 +583,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -564,7 +602,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"} # type: ignore @distributed_trace @@ -581,6 +619,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.AutoscaleSettingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutoscaleSettingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -591,6 +631,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -600,6 +641,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -617,7 +659,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -631,4 +677,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_category_operations.py index ffd2e9c2338f8..c8bb1ff97740b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_category_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_category_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,29 +64,30 @@ def build_list_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,16 +137,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,7 +168,7 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}"} # type: ignore @distributed_trace @@ -179,6 +188,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsCategoryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -189,6 +200,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -198,6 +210,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -215,7 +228,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -229,4 +246,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_operations.py index 999327ae2c825..3ff1990686382 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,34 +69,34 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-05-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -107,30 +108,31 @@ def build_delete_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -139,29 +141,30 @@ def build_list_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -211,16 +214,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -235,7 +245,7 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -266,6 +276,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DiagnosticSettingsResource') @@ -273,6 +284,7 @@ def create_or_update( request = build_create_or_update_request( resource_uri=resource_uri, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -280,7 +292,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -295,11 +311,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, name: str, @@ -322,16 +338,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -342,7 +365,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -362,6 +385,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -372,6 +397,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -381,6 +407,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -398,7 +425,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -412,4 +443,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_management_group_diagnostic_settings_operations.py index 20ca8defd85f2..59a6acaea1868 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_management_group_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_management_group_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,34 +69,34 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-05-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -107,30 +108,31 @@ def build_delete_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str', skip_quote=True), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -139,29 +141,30 @@ def build_list_request( management_group_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings') + _url = kwargs.pop("template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings") # pylint: disable=line-too-long path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str', skip_quote=True), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -212,16 +215,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( management_group_id=management_group_id, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -236,7 +246,7 @@ def get( return deserialized - get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -268,6 +278,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ManagementGroupDiagnosticSettingsResource') @@ -275,6 +286,7 @@ def create_or_update( request = build_create_or_update_request( management_group_id=management_group_id, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -282,7 +294,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -297,11 +313,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, management_group_id: str, name: str, @@ -324,16 +340,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_delete_request( management_group_id=management_group_id, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,7 +367,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -364,6 +387,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -374,6 +399,7 @@ def prepare_request(next_link=None): request = build_list_request( management_group_id=management_group_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -383,6 +409,7 @@ def prepare_request(next_link=None): request = build_list_request( management_group_id=management_group_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -400,7 +427,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -414,4 +445,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore + 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/v2021_05_01_preview/operations/_predictive_metric_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_predictive_metric_operations.py index 67ae8f3a043c6..1ebcdc5e8a10e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_predictive_metric_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_predictive_metric_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,36 +38,37 @@ def build_get_request( aggregation: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') - query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') - query_parameters['metricNamespace'] = _SERIALIZER.query("metric_namespace", metric_namespace, 'str') - query_parameters['metricName'] = _SERIALIZER.query("metric_name", metric_name, 'str') - query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['timespan'] = _SERIALIZER.query("timespan", timespan, 'str') + _query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') + _query_parameters['metricNamespace'] = _SERIALIZER.query("metric_namespace", metric_namespace, 'str') + _query_parameters['metricName'] = _SERIALIZER.query("metric_name", metric_name, 'str') + _query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,11 +136,14 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, autoscale_setting_name=autoscale_setting_name, + api_version=api_version, timespan=timespan, interval=interval, metric_namespace=metric_namespace, @@ -150,7 +154,11 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -165,5 +173,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_subscription_diagnostic_settings_operations.py index d69b8767906d0..e1fd1dd66c1c4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_subscription_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_subscription_diagnostic_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,34 +69,34 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-05-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -107,30 +108,31 @@ def build_delete_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -139,29 +141,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -209,16 +212,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -233,7 +243,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -262,6 +272,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SubscriptionDiagnosticSettingsResource') @@ -269,6 +280,7 @@ def create_or_update( request = build_create_or_update_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -276,7 +288,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -291,11 +307,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, name: str, **kwargs: Any @@ -315,16 +331,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -335,7 +358,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}"} # type: ignore @distributed_trace @@ -352,6 +375,8 @@ def list( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -362,6 +387,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -371,6 +397,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -388,7 +415,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -402,4 +433,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_configuration.py index 51092e4922167..d80b5f349efb0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_metadata.json index 935381fe6e10f..ed28d78544de2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_monitor_management_client.py index 2c252c063fa9a..38b561c4c434e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -30,8 +31,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -55,7 +59,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/_configuration.py index 2ae420e155183..c956c3bd2fc46 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/_monitor_management_client.py index d852f15ba63d0..0fb2ffce513d5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -31,8 +32,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/operations/_action_groups_operations.py index 769a807cdbc8f..04cc1de450e23 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/aio/operations/_action_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -83,6 +83,7 @@ async def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -109,7 +114,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -136,17 +141,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,11 +173,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -188,17 +200,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -209,7 +228,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace_async @@ -239,6 +258,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -247,6 +267,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -254,7 +275,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -269,7 +294,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}"} # type: ignore async def _post_test_notifications_initial( @@ -283,12 +308,14 @@ async def _post_test_notifications_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(notification_request, 'NotificationRequestBody') request = build_post_test_notifications_request_initial( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._post_test_notifications_initial.metadata['url'], @@ -296,7 +323,11 @@ async def _post_test_notifications_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -310,7 +341,7 @@ async def _post_test_notifications_initial( return deserialized - _post_test_notifications_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications'} # type: ignore + _post_test_notifications_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications"} # type: ignore @distributed_trace_async @@ -338,8 +369,9 @@ async def begin_post_test_notifications( ~azure.core.polling.AsyncLROPoller[~$(python-base-namespace).v2021_09_01.models.TestNotificationResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.TestNotificationResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -349,6 +381,7 @@ async def begin_post_test_notifications( if cont_token is None: raw_result = await self._post_test_notifications_initial( notification_request=notification_request, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -373,10 +406,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_test_notifications.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications'} # type: ignore + begin_post_test_notifications.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications"} # type: ignore @distributed_trace_async async def get_test_notifications( @@ -399,16 +431,23 @@ async def get_test_notifications( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + request = build_get_test_notifications_request( subscription_id=self._config.subscription_id, notification_id=notification_id, + api_version=api_version, template_url=self.get_test_notifications.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -423,7 +462,7 @@ async def get_test_notifications( return deserialized - get_test_notifications.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}'} # type: ignore + get_test_notifications.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}"} # type: ignore @distributed_trace @@ -439,6 +478,8 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -449,6 +490,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -458,6 +500,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -475,7 +518,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -489,7 +536,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -507,6 +554,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -518,6 +567,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -528,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -545,7 +596,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -559,10 +614,10 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups"} # type: ignore @distributed_trace_async - async def enable_receiver( + async def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -589,6 +644,7 @@ async def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -597,6 +653,7 @@ async def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -604,7 +661,11 @@ async def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -615,5 +676,5 @@ async def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/operations/_action_groups_operations.py index b48ab2b71f6d6..a9db1670701f2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/operations/_action_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-09-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -79,31 +79,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01" + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -114,31 +115,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01" + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -152,35 +154,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-09-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -194,33 +196,33 @@ def build_post_test_notifications_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-09-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -232,30 +234,31 @@ def build_get_test_notifications_request( notification_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01" + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "notificationId": _SERIALIZER.url("notification_id", notification_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -264,29 +267,30 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01" + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -296,30 +300,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01" + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -333,35 +338,35 @@ def build_enable_receiver_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-09-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -416,6 +421,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group, 'ActionGroupResource') @@ -424,6 +430,7 @@ def create_or_update( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -431,7 +438,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -450,7 +461,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -477,17 +488,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -502,11 +520,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -529,17 +547,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -550,7 +575,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}"} # type: ignore @distributed_trace @@ -580,6 +605,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') @@ -588,6 +614,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, action_group_name=action_group_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -595,7 +622,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -610,7 +641,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}"} # type: ignore def _post_test_notifications_initial( @@ -624,12 +655,14 @@ def _post_test_notifications_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(notification_request, 'NotificationRequestBody') request = build_post_test_notifications_request_initial( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._post_test_notifications_initial.metadata['url'], @@ -637,7 +670,11 @@ def _post_test_notifications_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -651,7 +688,7 @@ def _post_test_notifications_initial( return deserialized - _post_test_notifications_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications'} # type: ignore + _post_test_notifications_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications"} # type: ignore @distributed_trace @@ -679,8 +716,9 @@ def begin_post_test_notifications( ~azure.core.polling.LROPoller[~$(python-base-namespace).v2021_09_01.models.TestNotificationResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.TestNotificationResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -690,6 +728,7 @@ def begin_post_test_notifications( if cont_token is None: raw_result = self._post_test_notifications_initial( notification_request=notification_request, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -714,10 +753,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_test_notifications.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications'} # type: ignore + begin_post_test_notifications.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications"} # type: ignore @distributed_trace def get_test_notifications( @@ -740,16 +778,23 @@ def get_test_notifications( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + request = build_get_test_notifications_request( subscription_id=self._config.subscription_id, notification_id=notification_id, + api_version=api_version, template_url=self.get_test_notifications.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -764,7 +809,7 @@ def get_test_notifications( return deserialized - get_test_notifications.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}'} # type: ignore + get_test_notifications.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}"} # type: ignore @distributed_trace @@ -780,6 +825,8 @@ def list_by_subscription_id( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -790,6 +837,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription_id.metadata['url'], ) request = _convert_request(request) @@ -799,6 +847,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_id_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -816,7 +865,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -830,7 +883,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups'} # type: ignore + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups"} # type: ignore @distributed_trace def list_by_resource_group( @@ -848,6 +901,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_09_01.models.ActionGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -859,6 +914,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -869,6 +925,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -886,7 +943,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -900,10 +961,10 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups"} # type: ignore @distributed_trace - def enable_receiver( + def enable_receiver( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, action_group_name: str, @@ -930,6 +991,7 @@ def enable_receiver( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(enable_request, 'EnableRequest') @@ -938,6 +1000,7 @@ def enable_receiver( resource_group_name=resource_group_name, action_group_name=action_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.enable_receiver.metadata['url'], @@ -945,7 +1008,11 @@ def enable_receiver( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -956,5 +1023,5 @@ def enable_receiver( if cls: return cls(pipeline_response, None, {}) - enable_receiver.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe'} # type: ignore + enable_receiver.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_configuration.py index 96ea531748cd6..4061774404082 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_metadata.json index 828831e97da85..82c79f95fc193 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_monitor_management_client.py index c755626c0bd39..11fe9afade3a7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import MonitorManagementClientConfiguration @@ -37,8 +38,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -62,7 +66,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_version.py index 47babc28d5edf..e5754a47ce68f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/_configuration.py index c004814b44c1e..8f3d74250c485 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClientConfiguration(Configuration): +class MonitorManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MonitorManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class MonitorManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/_monitor_management_client.py index eaeaa74c87d53..a54fe3e49a6f7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/_monitor_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import MonitorManagementClientConfiguration @@ -37,8 +38,11 @@ class MonitorManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_endpoints_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_endpoints_operations.py index 515853ab89a22..ab6a0fcc9faa8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_endpoints_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_endpoints_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -65,6 +64,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionEndpointResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,7 +106,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,7 +124,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints"} # type: ignore @distributed_trace def list_by_subscription( @@ -135,6 +142,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionEndpointResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -145,6 +154,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -154,6 +164,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -171,7 +182,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,7 +200,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints"} # type: ignore @distributed_trace_async async def get( @@ -214,17 +229,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,7 +261,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace_async @@ -259,7 +281,7 @@ async def create( :param data_collection_endpoint_name: The name of the data collection endpoint. The name is case insensitive. :type data_collection_endpoint_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionEndpointResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionEndpointResource, or the result of cls(response) @@ -272,6 +294,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -283,6 +306,7 @@ async def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -290,7 +314,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -309,7 +337,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace_async @@ -329,7 +357,7 @@ async def update( :param data_collection_endpoint_name: The name of the data collection endpoint. The name is case insensitive. :type data_collection_endpoint_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionEndpointResource, or the result of cls(response) @@ -342,6 +370,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -353,6 +382,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -360,7 +390,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -375,11 +409,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_endpoint_name: str, @@ -405,17 +439,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -426,5 +467,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_rule_associations_operations.py index b2e9f132408ac..b86cfe43b2db5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_rule_associations_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_rule_associations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -65,6 +64,8 @@ def list_by_resource( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +76,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list_by_resource.metadata['url'], ) request = _convert_request(request) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,7 +104,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,7 +122,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + list_by_resource.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations"} # type: ignore @distributed_trace def list_by_rule( @@ -140,6 +147,8 @@ def list_by_rule( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -152,6 +161,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.list_by_rule.metadata['url'], ) request = _convert_request(request) @@ -163,6 +173,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -180,7 +191,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -194,7 +209,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + list_by_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations"} # type: ignore @distributed_trace def list_by_data_collection_endpoint( @@ -219,6 +234,8 @@ def list_by_data_collection_endpoint( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -231,6 +248,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.list_by_data_collection_endpoint.metadata['url'], ) request = _convert_request(request) @@ -242,6 +260,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -259,7 +278,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -273,7 +296,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_data_collection_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations'} # type: ignore + list_by_data_collection_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations"} # type: ignore @distributed_trace_async async def get( @@ -302,16 +325,23 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -326,7 +356,7 @@ async def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace_async @@ -345,7 +375,7 @@ async def create( :type resource_uri: str :param association_name: The name of the association. The name is case insensitive. :type association_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource :keyword callable cls: A custom type or function that will be passed the direct response @@ -360,6 +390,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -370,6 +401,7 @@ async def create( request = build_create_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -377,7 +409,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -396,11 +432,11 @@ async def create( return deserialized - create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + create.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, association_name: str, @@ -425,16 +461,23 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -445,5 +488,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_rules_operations.py index 5e5ae199e5386..ec1fbdc39dd5b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/aio/operations/_data_collection_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -65,6 +64,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,7 +106,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,7 +124,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace def list_by_subscription( @@ -135,6 +142,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -145,6 +154,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -154,6 +164,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -171,7 +182,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,7 +200,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace_async async def get( @@ -214,17 +229,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,7 +261,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace_async @@ -259,7 +281,7 @@ async def create( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -272,6 +294,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -283,6 +306,7 @@ async def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -290,7 +314,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -309,7 +337,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace_async @@ -329,7 +357,7 @@ async def update( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -342,6 +370,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -353,6 +382,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -360,7 +390,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -375,11 +409,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_rule_name: str, @@ -405,17 +439,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -426,5 +467,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_endpoints_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_endpoints_operations.py index 0256d05f2e38e..81244bcdd5d01 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_endpoints_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_endpoints_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,29 +65,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,31 +99,32 @@ def build_get_request( data_collection_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionEndpointName": _SERIALIZER.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,35 +138,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-09-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionEndpointName": _SERIALIZER.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -179,35 +182,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-09-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionEndpointName": _SERIALIZER.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -220,31 +223,32 @@ def build_delete_request( data_collection_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionEndpointName": _SERIALIZER.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -289,6 +293,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionEndpointResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -300,6 +306,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -310,6 +317,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -327,7 +335,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -341,7 +353,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints"} # type: ignore @distributed_trace def list_by_subscription( @@ -359,6 +371,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionEndpointResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -369,6 +383,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -378,6 +393,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -395,7 +411,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,7 +429,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints"} # type: ignore @distributed_trace def get( @@ -438,17 +458,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -463,7 +490,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace @@ -483,7 +510,7 @@ def create( :param data_collection_endpoint_name: The name of the data collection endpoint. The name is case insensitive. :type data_collection_endpoint_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionEndpointResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionEndpointResource, or the result of cls(response) @@ -496,6 +523,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -507,6 +535,7 @@ def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -514,7 +543,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -533,7 +566,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace @@ -553,7 +586,7 @@ def update( :param data_collection_endpoint_name: The name of the data collection endpoint. The name is case insensitive. :type data_collection_endpoint_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionEndpointResource, or the result of cls(response) @@ -566,6 +599,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -577,6 +611,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -584,7 +619,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,11 +638,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_endpoint_name: str, @@ -629,17 +668,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -650,5 +696,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_rule_associations_operations.py index 9ed841948399d..d40b9c3bf3314 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_rule_associations_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_rule_associations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_resource_request( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations") path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,31 +65,32 @@ def build_list_by_rule_request( data_collection_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -99,31 +101,32 @@ def build_list_by_data_collection_endpoint_request( data_collection_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionEndpointName": _SERIALIZER.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -133,30 +136,31 @@ def build_get_request( association_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -169,34 +173,34 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-09-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -208,30 +212,31 @@ def build_delete_request( association_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}') + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") # pylint: disable=line-too-long path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), "associationName": _SERIALIZER.url("association_name", association_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -276,6 +281,8 @@ def list_by_resource( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -286,6 +293,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=self.list_by_resource.metadata['url'], ) request = _convert_request(request) @@ -295,6 +303,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_request( resource_uri=resource_uri, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -312,7 +321,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -326,7 +339,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + list_by_resource.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations"} # type: ignore @distributed_trace def list_by_rule( @@ -351,6 +364,8 @@ def list_by_rule( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -363,6 +378,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.list_by_rule.metadata['url'], ) request = _convert_request(request) @@ -374,6 +390,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -391,7 +408,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,7 +426,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + list_by_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations"} # type: ignore @distributed_trace def list_by_data_collection_endpoint( @@ -430,6 +451,8 @@ def list_by_data_collection_endpoint( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -442,6 +465,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=self.list_by_data_collection_endpoint.metadata['url'], ) request = _convert_request(request) @@ -453,6 +477,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_endpoint_name=data_collection_endpoint_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -470,7 +495,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,7 +513,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_data_collection_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations'} # type: ignore + list_by_data_collection_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations"} # type: ignore @distributed_trace def get( @@ -513,16 +542,23 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_get_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -537,7 +573,7 @@ def get( return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace @@ -556,7 +592,7 @@ def create( :type resource_uri: str :param association_name: The name of the association. The name is case insensitive. :type association_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource :keyword callable cls: A custom type or function that will be passed the direct response @@ -571,6 +607,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -581,6 +618,7 @@ def create( request = build_create_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -588,7 +626,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -607,11 +649,11 @@ def create( return deserialized - create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + create.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_uri: str, association_name: str, @@ -636,16 +678,23 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_delete_request( resource_uri=resource_uri, association_name=association_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -656,5 +705,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_rules_operations.py index 840d4b52a7425..c045c28cd49ce 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2022_02_01_preview/operations/_data_collection_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,30 +32,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -64,29 +65,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,31 +99,32 @@ def build_get_request( data_collection_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,35 +138,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-09-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -179,35 +182,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-09-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -220,31 +223,32 @@ def build_delete_request( data_collection_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-09-01-preview" + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -289,6 +293,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -300,6 +306,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -310,6 +317,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -327,7 +335,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -341,7 +353,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace def list_by_subscription( @@ -359,6 +371,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -369,6 +383,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -378,6 +393,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -395,7 +411,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,7 +429,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules"} # type: ignore @distributed_trace def get( @@ -438,17 +458,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -463,7 +490,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace @@ -483,7 +510,7 @@ def create( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.DataCollectionRuleResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -496,6 +523,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -507,6 +535,7 @@ def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -514,7 +543,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -533,7 +566,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace @@ -553,7 +586,7 @@ def update( :param data_collection_rule_name: The name of the data collection rule. The name is case insensitive. :type data_collection_rule_name: str - :param body: The payload. + :param body: The payload. Default value is None. :type body: ~$(python-base-namespace).v2022_02_01_preview.models.ResourceForUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleResource, or the result of cls(response) @@ -566,6 +599,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: @@ -577,6 +611,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -584,7 +619,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,11 +638,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, data_collection_rule_name: str, @@ -629,17 +668,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, data_collection_rule_name=data_collection_rule_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -650,5 +696,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"} # type: ignore