diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/_meta.json b/sdk/dnsresolver/azure-mgmt-dnsresolver/_meta.json index 5403f47ba700..0bb2de7702ec 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/_meta.json +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/_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": "78f1d9d2be5ae24a9bebb5a62158f04d9cb7f69f", + "commit": "c8011998ed5c84ae1d8890a008066c9281148cf0", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/dnsresolver/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/dnsresolver/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/dnsresolver/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_configuration.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_configuration.py index aa80881f1a07..3de8b43fca1c 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_configuration.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class DnsResolverManagementClientConfiguration(Configuration): +class DnsResolverManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for DnsResolverManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class DnsResolverManagementClientConfiguration(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-04-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(DnsResolverManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-04-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-04-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-dnsresolver/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_dns_resolver_management_client.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_dns_resolver_management_client.py index 7f389b0e6ddf..8a647d4dd206 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_dns_resolver_management_client.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_dns_resolver_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 DnsResolverManagementClientConfiguration @@ -25,27 +26,27 @@ class DnsResolverManagementClient: """The DNS Resolver Management Client. :ivar dns_resolvers: DnsResolversOperations operations - :vartype dns_resolvers: dns_resolver_management_client.operations.DnsResolversOperations + :vartype dns_resolvers: azure.mgmt.dnsresolver.operations.DnsResolversOperations :ivar inbound_endpoints: InboundEndpointsOperations operations - :vartype inbound_endpoints: - dns_resolver_management_client.operations.InboundEndpointsOperations + :vartype inbound_endpoints: azure.mgmt.dnsresolver.operations.InboundEndpointsOperations :ivar outbound_endpoints: OutboundEndpointsOperations operations - :vartype outbound_endpoints: - dns_resolver_management_client.operations.OutboundEndpointsOperations + :vartype outbound_endpoints: azure.mgmt.dnsresolver.operations.OutboundEndpointsOperations :ivar dns_forwarding_rulesets: DnsForwardingRulesetsOperations operations :vartype dns_forwarding_rulesets: - dns_resolver_management_client.operations.DnsForwardingRulesetsOperations + azure.mgmt.dnsresolver.operations.DnsForwardingRulesetsOperations :ivar forwarding_rules: ForwardingRulesOperations operations - :vartype forwarding_rules: dns_resolver_management_client.operations.ForwardingRulesOperations + :vartype forwarding_rules: azure.mgmt.dnsresolver.operations.ForwardingRulesOperations :ivar virtual_network_links: VirtualNetworkLinksOperations operations - :vartype virtual_network_links: - dns_resolver_management_client.operations.VirtualNetworkLinksOperations + :vartype virtual_network_links: azure.mgmt.dnsresolver.operations.VirtualNetworkLinksOperations :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 "2020-04-01-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. """ @@ -74,7 +75,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/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_metadata.json b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_metadata.json index f53b47be216e..9b1b3d305941 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_metadata.json +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/_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\": [\"DnsResolverManagementClientConfiguration\"]}}, \"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\": [\"DnsResolverManagementClientConfiguration\"]}}, \"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\": [\"DnsResolverManagementClientConfiguration\"]}, \"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\": [\"DnsResolverManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/_configuration.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/_configuration.py index 8b6c7fd3310e..7b1e806b16f1 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/_configuration.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class DnsResolverManagementClientConfiguration(Configuration): +class DnsResolverManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for DnsResolverManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class DnsResolverManagementClientConfiguration(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-04-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(DnsResolverManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-04-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-04-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-dnsresolver/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/_dns_resolver_management_client.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/_dns_resolver_management_client.py index 69292fa1c1ce..bbdd5041b413 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/_dns_resolver_management_client.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/_dns_resolver_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 DnsResolverManagementClientConfiguration @@ -25,28 +26,28 @@ class DnsResolverManagementClient: """The DNS Resolver Management Client. :ivar dns_resolvers: DnsResolversOperations operations - :vartype dns_resolvers: dns_resolver_management_client.aio.operations.DnsResolversOperations + :vartype dns_resolvers: azure.mgmt.dnsresolver.aio.operations.DnsResolversOperations :ivar inbound_endpoints: InboundEndpointsOperations operations - :vartype inbound_endpoints: - dns_resolver_management_client.aio.operations.InboundEndpointsOperations + :vartype inbound_endpoints: azure.mgmt.dnsresolver.aio.operations.InboundEndpointsOperations :ivar outbound_endpoints: OutboundEndpointsOperations operations - :vartype outbound_endpoints: - dns_resolver_management_client.aio.operations.OutboundEndpointsOperations + :vartype outbound_endpoints: azure.mgmt.dnsresolver.aio.operations.OutboundEndpointsOperations :ivar dns_forwarding_rulesets: DnsForwardingRulesetsOperations operations :vartype dns_forwarding_rulesets: - dns_resolver_management_client.aio.operations.DnsForwardingRulesetsOperations + azure.mgmt.dnsresolver.aio.operations.DnsForwardingRulesetsOperations :ivar forwarding_rules: ForwardingRulesOperations operations - :vartype forwarding_rules: - dns_resolver_management_client.aio.operations.ForwardingRulesOperations + :vartype forwarding_rules: azure.mgmt.dnsresolver.aio.operations.ForwardingRulesOperations :ivar virtual_network_links: VirtualNetworkLinksOperations operations :vartype virtual_network_links: - dns_resolver_management_client.aio.operations.VirtualNetworkLinksOperations + azure.mgmt.dnsresolver.aio.operations.VirtualNetworkLinksOperations :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 "2020-04-01-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/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_dns_forwarding_rulesets_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_dns_forwarding_rulesets_operations.py index cc5966db1b25..c05023f87ab5 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_dns_forwarding_rulesets_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_dns_forwarding_rulesets_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 @@ -33,7 +32,7 @@ class DnsForwardingRulesetsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DnsForwardingRuleset') @@ -71,6 +71,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -80,7 +81,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]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace_async @@ -119,13 +124,13 @@ async def begin_create_or_update( :param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. :type dns_forwarding_ruleset_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.DnsForwardingRuleset + :type parameters: ~azure.mgmt.dnsresolver.models.DnsForwardingRuleset :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -137,12 +142,12 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DnsForwardingRuleset or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.DnsForwardingRuleset] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.DnsForwardingRuleset"] lro_delay = kwargs.pop( 'polling_interval', @@ -156,6 +161,7 @@ async def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -180,10 +186,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore async def _update_initial( self, @@ -199,6 +204,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DnsForwardingRulesetPatch') @@ -207,6 +213,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -215,7 +222,11 @@ async def _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]: @@ -231,7 +242,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace_async @@ -250,10 +261,10 @@ async def begin_update( :param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. :type dns_forwarding_ruleset_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.DnsForwardingRulesetPatch + :type parameters: ~azure.mgmt.dnsresolver.models.DnsForwardingRulesetPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -265,12 +276,12 @@ async def begin_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DnsForwardingRuleset or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.DnsForwardingRuleset] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.DnsForwardingRuleset"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,6 +294,7 @@ async def begin_update( dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -307,12 +319,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -325,18 +336,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, if_match=if_match, 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]: @@ -346,11 +364,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -366,7 +384,7 @@ async def begin_delete( :type dns_forwarding_ruleset_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -380,7 +398,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', "2020-04-01-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', @@ -392,6 +411,7 @@ async def begin_delete( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -412,10 +432,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.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace_async async def get( @@ -432,7 +451,7 @@ async def get( :type dns_forwarding_ruleset_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DnsForwardingRuleset, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.DnsForwardingRuleset + :rtype: ~azure.mgmt.dnsresolver.models.DnsForwardingRuleset :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsForwardingRuleset"] @@ -441,17 +460,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_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]: @@ -465,7 +491,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace @@ -480,15 +506,17 @@ 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 top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DnsForwardingRulesetListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.DnsForwardingRulesetListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsForwardingRulesetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsForwardingRulesetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -500,6 +528,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, top=top, template_url=self.list_by_resource_group.metadata['url'], ) @@ -511,6 +540,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, top=top, template_url=next_link, ) @@ -529,7 +559,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]: @@ -542,7 +576,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.Network/dnsForwardingRulesets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets"} # type: ignore @distributed_trace def list( @@ -553,15 +587,17 @@ def list( """Lists DNS forwarding rulesets in all resource groups of a subscription. :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DnsForwardingRulesetListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.DnsForwardingRulesetListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsForwardingRulesetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsForwardingRulesetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -572,6 +608,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -582,6 +619,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, top=top, template_url=next_link, ) @@ -600,7 +638,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]: @@ -613,7 +655,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets"} # type: ignore @distributed_trace def list_by_virtual_network( @@ -630,15 +672,17 @@ def list_by_virtual_network( :param virtual_network_name: The name of the virtual network. :type virtual_network_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkDnsForwardingRulesetListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.VirtualNetworkDnsForwardingRulesetListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.VirtualNetworkDnsForwardingRulesetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkDnsForwardingRulesetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -651,6 +695,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, + api_version=api_version, top=top, template_url=self.list_by_virtual_network.metadata['url'], ) @@ -663,6 +708,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -681,7 +727,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]: @@ -694,4 +744,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsForwardingRulesets'} # type: ignore + list_by_virtual_network.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsForwardingRulesets"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_dns_resolvers_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_dns_resolvers_operations.py index 53df75f1cc7b..1a912904d0a6 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_dns_resolvers_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_dns_resolvers_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 @@ -33,7 +32,7 @@ class DnsResolversOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DnsResolver') @@ -71,6 +71,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -80,7 +81,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]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace_async @@ -119,13 +124,13 @@ async def begin_create_or_update( :param dns_resolver_name: The name of the DNS resolver. :type dns_resolver_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.DnsResolver + :type parameters: ~azure.mgmt.dnsresolver.models.DnsResolver :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -137,11 +142,12 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DnsResolver or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.DnsResolver] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolver] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.DnsResolver"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,6 +161,7 @@ async def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -179,10 +186,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore async def _update_initial( self, @@ -198,6 +204,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DnsResolverPatch') @@ -206,6 +213,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -214,7 +222,11 @@ async def _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]: @@ -230,7 +242,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace_async @@ -249,10 +261,10 @@ async def begin_update( :param dns_resolver_name: The name of the DNS resolver. :type dns_resolver_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.DnsResolverPatch + :type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -264,11 +276,12 @@ async def begin_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DnsResolver or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.DnsResolver] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.DnsResolver] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.DnsResolver"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,6 +294,7 @@ async def begin_update( dns_resolver_name=dns_resolver_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -305,12 +319,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -323,18 +336,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, if_match=if_match, 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]: @@ -344,11 +364,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -363,7 +383,7 @@ async def begin_delete( :type dns_resolver_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -377,7 +397,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', "2020-04-01-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', @@ -389,6 +410,7 @@ async def begin_delete( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -409,10 +431,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.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace_async async def get( @@ -429,7 +450,7 @@ async def get( :type dns_resolver_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DnsResolver, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.DnsResolver + :rtype: ~azure.mgmt.dnsresolver.models.DnsResolver :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsResolver"] @@ -438,17 +459,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_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]: @@ -462,7 +490,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace @@ -477,15 +505,17 @@ 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 top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DnsResolverListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.DnsResolverListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsResolverListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsResolverListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -497,6 +527,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, top=top, template_url=self.list_by_resource_group.metadata['url'], ) @@ -508,6 +539,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, top=top, template_url=next_link, ) @@ -526,7 +558,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]: @@ -539,7 +575,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.Network/dnsResolvers'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers"} # type: ignore @distributed_trace def list( @@ -550,15 +586,17 @@ def list( """Lists DNS resolvers in all resource groups of a subscription. :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DnsResolverListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.DnsResolverListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.DnsResolverListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsResolverListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -569,6 +607,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -579,6 +618,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, top=top, template_url=next_link, ) @@ -597,7 +637,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]: @@ -610,7 +654,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers"} # type: ignore @distributed_trace def list_by_virtual_network( @@ -627,15 +671,17 @@ def list_by_virtual_network( :param virtual_network_name: The name of the virtual network. :type virtual_network_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubResourceListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.SubResourceListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.SubResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -648,6 +694,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, + api_version=api_version, top=top, template_url=self.list_by_virtual_network.metadata['url'], ) @@ -660,6 +707,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -678,7 +726,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]: @@ -691,4 +743,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsResolvers'} # type: ignore + list_by_virtual_network.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsResolvers"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_forwarding_rules_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_forwarding_rules_operations.py index 074c4f8a108d..0ef921df7fb7 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_forwarding_rules_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_forwarding_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 @@ -31,7 +30,7 @@ class ForwardingRulesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -66,17 +65,17 @@ async def create_or_update( :param forwarding_rule_name: The name of the forwarding rule. :type forwarding_rule_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.ForwardingRule + :type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRule :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ForwardingRule, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.ForwardingRule + :rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ForwardingRule"] @@ -85,6 +84,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ForwardingRule') @@ -94,6 +94,7 @@ async def create_or_update( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, forwarding_rule_name=forwarding_rule_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -103,7 +104,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]: @@ -121,7 +126,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"} # type: ignore @distributed_trace_async @@ -143,14 +148,14 @@ async def update( :param forwarding_rule_name: The name of the forwarding rule. :type forwarding_rule_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.ForwardingRulePatch + :type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRulePatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ForwardingRule, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.ForwardingRule + :rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ForwardingRule"] @@ -159,6 +164,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ForwardingRulePatch') @@ -168,6 +174,7 @@ async def update( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, forwarding_rule_name=forwarding_rule_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -176,7 +183,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]: @@ -190,11 +201,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -213,7 +224,7 @@ async def delete( :type forwarding_rule_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -226,19 +237,26 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, forwarding_rule_name=forwarding_rule_name, + api_version=api_version, if_match=if_match, 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]: @@ -248,7 +266,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"} # type: ignore @distributed_trace_async @@ -269,7 +287,7 @@ async def get( :type forwarding_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ForwardingRule, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.ForwardingRule + :rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ForwardingRule"] @@ -278,18 +296,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, forwarding_rule_name=forwarding_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]: @@ -303,7 +328,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"} # type: ignore @distributed_trace @@ -321,15 +346,17 @@ def list( :param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. :type dns_forwarding_ruleset_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ForwardingRuleListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.ForwardingRuleListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.ForwardingRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ForwardingRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -342,6 +369,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -354,6 +382,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -372,7 +401,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]: @@ -385,4 +418,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_inbound_endpoints_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_inbound_endpoints_operations.py index 5dadba3dec11..50383ac4ea36 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_inbound_endpoints_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_inbound_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, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -33,7 +32,7 @@ class InboundEndpointsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,6 +63,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'InboundEndpoint') @@ -73,6 +73,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -82,7 +83,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]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace_async @@ -124,13 +129,13 @@ async def begin_create_or_update( :param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. :type inbound_endpoint_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.InboundEndpoint + :type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpoint :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -142,12 +147,12 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either InboundEndpoint or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.InboundEndpoint] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.InboundEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -162,6 +167,7 @@ async def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -186,10 +192,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore async def _update_initial( self, @@ -206,6 +211,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'InboundEndpointPatch') @@ -215,6 +221,7 @@ async def _update_initial( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -223,7 +230,11 @@ async def _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]: @@ -239,7 +250,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace_async @@ -261,10 +272,10 @@ async def begin_update( :param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. :type inbound_endpoint_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.InboundEndpointPatch + :type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpointPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -276,12 +287,12 @@ async def begin_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either InboundEndpoint or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.InboundEndpoint] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.InboundEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,6 +306,7 @@ async def begin_update( inbound_endpoint_name=inbound_endpoint_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -319,12 +331,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -338,19 +349,26 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_endpoint_name, + api_version=api_version, if_match=if_match, 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]: @@ -360,11 +378,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -382,7 +400,7 @@ async def begin_delete( :type inbound_endpoint_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -396,7 +414,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', "2020-04-01-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', @@ -409,6 +428,7 @@ async def begin_delete( dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_endpoint_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -429,10 +449,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.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace_async async def get( @@ -452,7 +471,7 @@ async def get( :type inbound_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: InboundEndpoint, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.InboundEndpoint + :rtype: ~azure.mgmt.dnsresolver.models.InboundEndpoint :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.InboundEndpoint"] @@ -461,18 +480,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_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]: @@ -486,7 +512,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace @@ -504,15 +530,17 @@ def list( :param dns_resolver_name: The name of the DNS resolver. :type dns_resolver_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either InboundEndpointListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.InboundEndpointListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.InboundEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.InboundEndpointListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -525,6 +553,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -537,6 +566,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -555,7 +585,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]: @@ -568,4 +602,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_outbound_endpoints_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_outbound_endpoints_operations.py index 8ad36befea6e..95a31440c50e 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_outbound_endpoints_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_outbound_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, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -33,7 +32,7 @@ class OutboundEndpointsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,6 +63,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OutboundEndpoint') @@ -73,6 +73,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -82,7 +83,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]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace_async @@ -124,13 +129,13 @@ async def begin_create_or_update( :param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver. :type outbound_endpoint_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.OutboundEndpoint + :type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpoint :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -142,12 +147,12 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either OutboundEndpoint or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.OutboundEndpoint] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.OutboundEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -162,6 +167,7 @@ async def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -186,10 +192,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore async def _update_initial( self, @@ -206,6 +211,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OutboundEndpointPatch') @@ -215,6 +221,7 @@ async def _update_initial( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -223,7 +230,11 @@ async def _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]: @@ -239,7 +250,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace_async @@ -261,10 +272,10 @@ async def begin_update( :param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver. :type outbound_endpoint_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.OutboundEndpointPatch + :type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpointPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -276,12 +287,12 @@ async def begin_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either OutboundEndpoint or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.OutboundEndpoint] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.OutboundEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,6 +306,7 @@ async def begin_update( outbound_endpoint_name=outbound_endpoint_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -319,12 +331,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -338,19 +349,26 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_endpoint_name, + api_version=api_version, if_match=if_match, 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]: @@ -360,11 +378,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -382,7 +400,7 @@ async def begin_delete( :type outbound_endpoint_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -396,7 +414,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', "2020-04-01-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', @@ -409,6 +428,7 @@ async def begin_delete( dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_endpoint_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -429,10 +449,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.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace_async async def get( @@ -452,7 +471,7 @@ async def get( :type outbound_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: OutboundEndpoint, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.OutboundEndpoint + :rtype: ~azure.mgmt.dnsresolver.models.OutboundEndpoint :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEndpoint"] @@ -461,18 +480,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_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]: @@ -486,7 +512,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace @@ -504,15 +530,17 @@ def list( :param dns_resolver_name: The name of the DNS resolver. :type dns_resolver_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OutboundEndpointListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.OutboundEndpointListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.OutboundEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEndpointListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -525,6 +553,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -537,6 +566,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -555,7 +585,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]: @@ -568,4 +602,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_virtual_network_links_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_virtual_network_links_operations.py index 7bc901dd15a4..ba74d8ca63b1 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_virtual_network_links_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/aio/operations/_virtual_network_links_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 @@ -33,7 +32,7 @@ class VirtualNetworkLinksOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,6 +63,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualNetworkLink') @@ -73,6 +73,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -82,7 +83,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]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace_async @@ -124,13 +129,13 @@ async def begin_create_or_update( :param virtual_network_link_name: The name of the virtual network link. :type virtual_network_link_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.VirtualNetworkLink + :type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -142,12 +147,12 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VirtualNetworkLink or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.VirtualNetworkLink] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.VirtualNetworkLink"] lro_delay = kwargs.pop( 'polling_interval', @@ -162,6 +167,7 @@ async def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -186,10 +192,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore async def _update_initial( self, @@ -206,6 +211,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualNetworkLinkPatch') @@ -215,6 +221,7 @@ async def _update_initial( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -223,7 +230,11 @@ async def _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]: @@ -239,7 +250,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace_async @@ -261,10 +272,10 @@ async def begin_update( :param virtual_network_link_name: The name of the virtual network link. :type virtual_network_link_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.VirtualNetworkLinkPatch + :type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLinkPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -276,12 +287,12 @@ async def begin_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VirtualNetworkLink or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~dns_resolver_management_client.models.VirtualNetworkLink] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.VirtualNetworkLink"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,6 +306,7 @@ async def begin_update( virtual_network_link_name=virtual_network_link_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -319,12 +331,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -338,19 +349,26 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_name, + api_version=api_version, if_match=if_match, 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]: @@ -360,11 +378,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -383,7 +401,7 @@ async def begin_delete( :type virtual_network_link_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -397,7 +415,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', "2020-04-01-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', @@ -410,6 +429,7 @@ async def begin_delete( dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -430,10 +450,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.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace_async async def get( @@ -453,7 +472,7 @@ async def get( :type virtual_network_link_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkLink, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.VirtualNetworkLink + :rtype: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLink"] @@ -462,18 +481,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_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]: @@ -487,7 +513,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace @@ -505,15 +531,17 @@ def list( :param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. :type dns_forwarding_ruleset_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkLinkListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~dns_resolver_management_client.models.VirtualNetworkLinkListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dnsresolver.models.VirtualNetworkLinkListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLinkListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -526,6 +554,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -538,6 +567,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -556,7 +586,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]: @@ -569,4 +603,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/models/_models_py3.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/models/_models_py3.py index d4fbc6749f77..05835d8a6b4a 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/models/_models_py3.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/models/_models_py3.py @@ -24,7 +24,7 @@ class CloudErrorBody(msrest.serialization.Model): :ivar target: The target resource of the error message. :vartype target: str :ivar details: Extra error information. - :vartype details: list[~dns_resolver_management_client.models.CloudErrorBody] + :vartype details: list[~azure.mgmt.dnsresolver.models.CloudErrorBody] """ _attribute_map = { @@ -51,7 +51,7 @@ def __init__( :keyword target: The target resource of the error message. :paramtype target: str :keyword details: Extra error information. - :paramtype details: list[~dns_resolver_management_client.models.CloudErrorBody] + :paramtype details: list[~azure.mgmt.dnsresolver.models.CloudErrorBody] """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code @@ -175,16 +175,15 @@ class DnsForwardingRuleset(TrackedResource): :ivar etag: ETag of the DNS forwarding ruleset. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~dns_resolver_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.dnsresolver.models.SystemData :ivar dns_resolver_outbound_endpoints: The reference to the DNS resolver outbound endpoints that are used to route DNS queries matching the forwarding rules in the ruleset to the target DNS servers. - :vartype dns_resolver_outbound_endpoints: - list[~dns_resolver_management_client.models.SubResource] + :vartype dns_resolver_outbound_endpoints: list[~azure.mgmt.dnsresolver.models.SubResource] :ivar provisioning_state: The current provisioning state of the DNS forwarding ruleset. This is a read-only property and any attempt to set this value will be ignored. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or ~dns_resolver_management_client.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.dnsresolver.models.ProvisioningState :ivar resource_guid: The resourceGuid for the DNS forwarding ruleset. :vartype resource_guid: str """ @@ -229,8 +228,7 @@ def __init__( :keyword dns_resolver_outbound_endpoints: The reference to the DNS resolver outbound endpoints that are used to route DNS queries matching the forwarding rules in the ruleset to the target DNS servers. - :paramtype dns_resolver_outbound_endpoints: - list[~dns_resolver_management_client.models.SubResource] + :paramtype dns_resolver_outbound_endpoints: list[~azure.mgmt.dnsresolver.models.SubResource] """ super(DnsForwardingRuleset, self).__init__(tags=tags, location=location, **kwargs) self.etag = None @@ -246,7 +244,7 @@ class DnsForwardingRulesetListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Enumeration of the DNS forwarding rulesets. - :vartype value: list[~dns_resolver_management_client.models.DnsForwardingRuleset] + :vartype value: list[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -268,7 +266,7 @@ def __init__( ): """ :keyword value: Enumeration of the DNS forwarding rulesets. - :paramtype value: list[~dns_resolver_management_client.models.DnsForwardingRuleset] + :paramtype value: list[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset] """ super(DnsForwardingRulesetListResult, self).__init__(**kwargs) self.value = value @@ -322,18 +320,18 @@ class DnsResolver(TrackedResource): :ivar etag: ETag of the DNS resolver. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~dns_resolver_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.dnsresolver.models.SystemData :ivar virtual_network: The reference to the virtual network. This cannot be changed after creation. - :vartype virtual_network: ~dns_resolver_management_client.models.SubResource + :vartype virtual_network: ~azure.mgmt.dnsresolver.models.SubResource :ivar dns_resolver_state: The current status of the DNS resolver. This is a read-only property and any attempt to set this value will be ignored. Possible values include: "Connected", "Disconnected". - :vartype dns_resolver_state: str or ~dns_resolver_management_client.models.DnsResolverState + :vartype dns_resolver_state: str or ~azure.mgmt.dnsresolver.models.DnsResolverState :ivar provisioning_state: The current provisioning state of the DNS resolver. This is a read-only property and any attempt to set this value will be ignored. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or ~dns_resolver_management_client.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.dnsresolver.models.ProvisioningState :ivar resource_guid: The resourceGuid property of the DNS resolver resource. :vartype resource_guid: str """ @@ -379,7 +377,7 @@ def __init__( :paramtype location: str :keyword virtual_network: The reference to the virtual network. This cannot be changed after creation. - :paramtype virtual_network: ~dns_resolver_management_client.models.SubResource + :paramtype virtual_network: ~azure.mgmt.dnsresolver.models.SubResource """ super(DnsResolver, self).__init__(tags=tags, location=location, **kwargs) self.etag = None @@ -396,7 +394,7 @@ class DnsResolverListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Enumeration of the DNS resolvers. - :vartype value: list[~dns_resolver_management_client.models.DnsResolver] + :vartype value: list[~azure.mgmt.dnsresolver.models.DnsResolver] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -418,7 +416,7 @@ def __init__( ): """ :keyword value: Enumeration of the DNS resolvers. - :paramtype value: list[~dns_resolver_management_client.models.DnsResolver] + :paramtype value: list[~azure.mgmt.dnsresolver.models.DnsResolver] """ super(DnsResolverListResult, self).__init__(**kwargs) self.value = value @@ -502,21 +500,20 @@ class ForwardingRule(ProxyResource): :ivar etag: ETag of the forwarding rule. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~dns_resolver_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.dnsresolver.models.SystemData :ivar domain_name: The domain name for the forwarding rule. :vartype domain_name: str :ivar target_dns_servers: DNS servers to forward the DNS query to. - :vartype target_dns_servers: list[~dns_resolver_management_client.models.TargetDnsServer] + :vartype target_dns_servers: list[~azure.mgmt.dnsresolver.models.TargetDnsServer] :ivar metadata: Metadata attached to the forwarding rule. :vartype metadata: dict[str, str] :ivar forwarding_rule_state: The state of forwarding rule. Possible values include: "Enabled", "Disabled". - :vartype forwarding_rule_state: str or - ~dns_resolver_management_client.models.ForwardingRuleState + :vartype forwarding_rule_state: str or ~azure.mgmt.dnsresolver.models.ForwardingRuleState :ivar provisioning_state: The current provisioning state of the forwarding rule. This is a read-only property and any attempt to set this value will be ignored. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or ~dns_resolver_management_client.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.dnsresolver.models.ProvisioningState """ _validation = { @@ -554,13 +551,12 @@ def __init__( :keyword domain_name: The domain name for the forwarding rule. :paramtype domain_name: str :keyword target_dns_servers: DNS servers to forward the DNS query to. - :paramtype target_dns_servers: list[~dns_resolver_management_client.models.TargetDnsServer] + :paramtype target_dns_servers: list[~azure.mgmt.dnsresolver.models.TargetDnsServer] :keyword metadata: Metadata attached to the forwarding rule. :paramtype metadata: dict[str, str] :keyword forwarding_rule_state: The state of forwarding rule. Possible values include: "Enabled", "Disabled". - :paramtype forwarding_rule_state: str or - ~dns_resolver_management_client.models.ForwardingRuleState + :paramtype forwarding_rule_state: str or ~azure.mgmt.dnsresolver.models.ForwardingRuleState """ super(ForwardingRule, self).__init__(**kwargs) self.etag = None @@ -578,7 +574,7 @@ class ForwardingRuleListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Enumeration of the forwarding rules. - :vartype value: list[~dns_resolver_management_client.models.ForwardingRule] + :vartype value: list[~azure.mgmt.dnsresolver.models.ForwardingRule] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -600,7 +596,7 @@ def __init__( ): """ :keyword value: Enumeration of the forwarding rules. - :paramtype value: list[~dns_resolver_management_client.models.ForwardingRule] + :paramtype value: list[~azure.mgmt.dnsresolver.models.ForwardingRule] """ super(ForwardingRuleListResult, self).__init__(**kwargs) self.value = value @@ -611,13 +607,12 @@ class ForwardingRulePatch(msrest.serialization.Model): """Describes a forwarding rule for PATCH operation. :ivar target_dns_servers: DNS servers to forward the DNS query to. - :vartype target_dns_servers: list[~dns_resolver_management_client.models.TargetDnsServer] + :vartype target_dns_servers: list[~azure.mgmt.dnsresolver.models.TargetDnsServer] :ivar metadata: Metadata attached to the forwarding rule. :vartype metadata: dict[str, str] :ivar forwarding_rule_state: The state of forwarding rule. Possible values include: "Enabled", "Disabled". - :vartype forwarding_rule_state: str or - ~dns_resolver_management_client.models.ForwardingRuleState + :vartype forwarding_rule_state: str or ~azure.mgmt.dnsresolver.models.ForwardingRuleState """ _attribute_map = { @@ -636,13 +631,12 @@ def __init__( ): """ :keyword target_dns_servers: DNS servers to forward the DNS query to. - :paramtype target_dns_servers: list[~dns_resolver_management_client.models.TargetDnsServer] + :paramtype target_dns_servers: list[~azure.mgmt.dnsresolver.models.TargetDnsServer] :keyword metadata: Metadata attached to the forwarding rule. :paramtype metadata: dict[str, str] :keyword forwarding_rule_state: The state of forwarding rule. Possible values include: "Enabled", "Disabled". - :paramtype forwarding_rule_state: str or - ~dns_resolver_management_client.models.ForwardingRuleState + :paramtype forwarding_rule_state: str or ~azure.mgmt.dnsresolver.models.ForwardingRuleState """ super(ForwardingRulePatch, self).__init__(**kwargs) self.target_dns_servers = target_dns_servers @@ -672,13 +666,13 @@ class InboundEndpoint(TrackedResource): :ivar etag: ETag of the inbound endpoint. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~dns_resolver_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.dnsresolver.models.SystemData :ivar ip_configurations: IP configurations for the inbound endpoint. - :vartype ip_configurations: list[~dns_resolver_management_client.models.IpConfiguration] + :vartype ip_configurations: list[~azure.mgmt.dnsresolver.models.IpConfiguration] :ivar provisioning_state: The current provisioning state of the inbound endpoint. This is a read-only property and any attempt to set this value will be ignored. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or ~dns_resolver_management_client.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.dnsresolver.models.ProvisioningState :ivar resource_guid: The resourceGuid property of the inbound endpoint resource. :vartype resource_guid: str """ @@ -721,7 +715,7 @@ def __init__( :keyword location: Required. The geo-location where the resource lives. :paramtype location: str :keyword ip_configurations: IP configurations for the inbound endpoint. - :paramtype ip_configurations: list[~dns_resolver_management_client.models.IpConfiguration] + :paramtype ip_configurations: list[~azure.mgmt.dnsresolver.models.IpConfiguration] """ super(InboundEndpoint, self).__init__(tags=tags, location=location, **kwargs) self.etag = None @@ -737,7 +731,7 @@ class InboundEndpointListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Enumeration of the inbound endpoints for a DNS resolver. - :vartype value: list[~dns_resolver_management_client.models.InboundEndpoint] + :vartype value: list[~azure.mgmt.dnsresolver.models.InboundEndpoint] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -759,7 +753,7 @@ def __init__( ): """ :keyword value: Enumeration of the inbound endpoints for a DNS resolver. - :paramtype value: list[~dns_resolver_management_client.models.InboundEndpoint] + :paramtype value: list[~azure.mgmt.dnsresolver.models.InboundEndpoint] """ super(InboundEndpointListResult, self).__init__(**kwargs) self.value = value @@ -795,13 +789,12 @@ class IpConfiguration(msrest.serialization.Model): """IP configuration. :ivar subnet: The reference to the subnet bound to the IP configuration. - :vartype subnet: ~dns_resolver_management_client.models.SubResource + :vartype subnet: ~azure.mgmt.dnsresolver.models.SubResource :ivar private_ip_address: Private IP address of the IP configuration. :vartype private_ip_address: str :ivar private_ip_allocation_method: Private IP address allocation method. Possible values include: "Static", "Dynamic". Default value: "Dynamic". - :vartype private_ip_allocation_method: str or - ~dns_resolver_management_client.models.IpAllocationMethod + :vartype private_ip_allocation_method: str or ~azure.mgmt.dnsresolver.models.IpAllocationMethod """ _attribute_map = { @@ -820,13 +813,13 @@ def __init__( ): """ :keyword subnet: The reference to the subnet bound to the IP configuration. - :paramtype subnet: ~dns_resolver_management_client.models.SubResource + :paramtype subnet: ~azure.mgmt.dnsresolver.models.SubResource :keyword private_ip_address: Private IP address of the IP configuration. :paramtype private_ip_address: str :keyword private_ip_allocation_method: Private IP address allocation method. Possible values include: "Static", "Dynamic". Default value: "Dynamic". :paramtype private_ip_allocation_method: str or - ~dns_resolver_management_client.models.IpAllocationMethod + ~azure.mgmt.dnsresolver.models.IpAllocationMethod """ super(IpConfiguration, self).__init__(**kwargs) self.subnet = subnet @@ -856,13 +849,13 @@ class OutboundEndpoint(TrackedResource): :ivar etag: ETag of the outbound endpoint. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~dns_resolver_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.dnsresolver.models.SystemData :ivar subnet: The reference to the subnet used for the outbound endpoint. - :vartype subnet: ~dns_resolver_management_client.models.SubResource + :vartype subnet: ~azure.mgmt.dnsresolver.models.SubResource :ivar provisioning_state: The current provisioning state of the outbound endpoint. This is a read-only property and any attempt to set this value will be ignored. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or ~dns_resolver_management_client.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.dnsresolver.models.ProvisioningState :ivar resource_guid: The resourceGuid property of the outbound endpoint resource. :vartype resource_guid: str """ @@ -905,7 +898,7 @@ def __init__( :keyword location: Required. The geo-location where the resource lives. :paramtype location: str :keyword subnet: The reference to the subnet used for the outbound endpoint. - :paramtype subnet: ~dns_resolver_management_client.models.SubResource + :paramtype subnet: ~azure.mgmt.dnsresolver.models.SubResource """ super(OutboundEndpoint, self).__init__(tags=tags, location=location, **kwargs) self.etag = None @@ -921,7 +914,7 @@ class OutboundEndpointListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Enumeration of the outbound endpoints for a DNS resolver. - :vartype value: list[~dns_resolver_management_client.models.OutboundEndpoint] + :vartype value: list[~azure.mgmt.dnsresolver.models.OutboundEndpoint] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -943,7 +936,7 @@ def __init__( ): """ :keyword value: Enumeration of the outbound endpoints for a DNS resolver. - :paramtype value: list[~dns_resolver_management_client.models.OutboundEndpoint] + :paramtype value: list[~azure.mgmt.dnsresolver.models.OutboundEndpoint] """ super(OutboundEndpointListResult, self).__init__(**kwargs) self.value = value @@ -1006,7 +999,7 @@ class SubResourceListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Enumeration of the sub-resources. - :vartype value: list[~dns_resolver_management_client.models.SubResource] + :vartype value: list[~azure.mgmt.dnsresolver.models.SubResource] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -1028,7 +1021,7 @@ def __init__( ): """ :keyword value: Enumeration of the sub-resources. - :paramtype value: list[~dns_resolver_management_client.models.SubResource] + :paramtype value: list[~azure.mgmt.dnsresolver.models.SubResource] """ super(SubResourceListResult, self).__init__(**kwargs) self.value = value @@ -1042,14 +1035,14 @@ class SystemData(msrest.serialization.Model): :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or ~dns_resolver_management_client.models.CreatedByType + :vartype created_by_type: str or ~azure.mgmt.dnsresolver.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :vartype last_modified_by_type: str or ~dns_resolver_management_client.models.CreatedByType + :vartype last_modified_by_type: str or ~azure.mgmt.dnsresolver.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime """ @@ -1079,14 +1072,14 @@ def __init__( :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or ~dns_resolver_management_client.models.CreatedByType + :paramtype created_by_type: str or ~azure.mgmt.dnsresolver.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype last_modified_by_type: str or ~dns_resolver_management_client.models.CreatedByType + :paramtype last_modified_by_type: str or ~azure.mgmt.dnsresolver.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ @@ -1137,7 +1130,7 @@ class VirtualNetworkDnsForwardingRuleset(msrest.serialization.Model): :ivar id: DNS Forwarding Ruleset Resource ID. :vartype id: str :ivar virtual_network_link: The reference to the virtual network link. - :vartype virtual_network_link: ~dns_resolver_management_client.models.SubResource + :vartype virtual_network_link: ~azure.mgmt.dnsresolver.models.SubResource """ _attribute_map = { @@ -1156,7 +1149,7 @@ def __init__( :keyword id: DNS Forwarding Ruleset Resource ID. :paramtype id: str :keyword virtual_network_link: The reference to the virtual network link. - :paramtype virtual_network_link: ~dns_resolver_management_client.models.SubResource + :paramtype virtual_network_link: ~azure.mgmt.dnsresolver.models.SubResource """ super(VirtualNetworkDnsForwardingRuleset, self).__init__(**kwargs) self.id = id @@ -1169,7 +1162,7 @@ class VirtualNetworkDnsForwardingRulesetListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Enumeration of the Virtual Network DNS Forwarding Ruleset. - :vartype value: list[~dns_resolver_management_client.models.VirtualNetworkDnsForwardingRuleset] + :vartype value: list[~azure.mgmt.dnsresolver.models.VirtualNetworkDnsForwardingRuleset] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -1191,8 +1184,7 @@ def __init__( ): """ :keyword value: Enumeration of the Virtual Network DNS Forwarding Ruleset. - :paramtype value: - list[~dns_resolver_management_client.models.VirtualNetworkDnsForwardingRuleset] + :paramtype value: list[~azure.mgmt.dnsresolver.models.VirtualNetworkDnsForwardingRuleset] """ super(VirtualNetworkDnsForwardingRulesetListResult, self).__init__(**kwargs) self.value = value @@ -1215,16 +1207,16 @@ class VirtualNetworkLink(ProxyResource): :ivar etag: ETag of the virtual network link. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~dns_resolver_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.dnsresolver.models.SystemData :ivar virtual_network: The reference to the virtual network. This cannot be changed after creation. - :vartype virtual_network: ~dns_resolver_management_client.models.SubResource + :vartype virtual_network: ~azure.mgmt.dnsresolver.models.SubResource :ivar metadata: Metadata attached to the virtual network link. :vartype metadata: dict[str, str] :ivar provisioning_state: The current provisioning state of the virtual network link. This is a read-only property and any attempt to set this value will be ignored. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or ~dns_resolver_management_client.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.dnsresolver.models.ProvisioningState """ _validation = { @@ -1257,7 +1249,7 @@ def __init__( """ :keyword virtual_network: The reference to the virtual network. This cannot be changed after creation. - :paramtype virtual_network: ~dns_resolver_management_client.models.SubResource + :paramtype virtual_network: ~azure.mgmt.dnsresolver.models.SubResource :keyword metadata: Metadata attached to the virtual network link. :paramtype metadata: dict[str, str] """ @@ -1275,7 +1267,7 @@ class VirtualNetworkLinkListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Enumeration of the virtual network links. - :vartype value: list[~dns_resolver_management_client.models.VirtualNetworkLink] + :vartype value: list[~azure.mgmt.dnsresolver.models.VirtualNetworkLink] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -1297,7 +1289,7 @@ def __init__( ): """ :keyword value: Enumeration of the virtual network links. - :paramtype value: list[~dns_resolver_management_client.models.VirtualNetworkLink] + :paramtype value: list[~azure.mgmt.dnsresolver.models.VirtualNetworkLink] """ super(VirtualNetworkLinkListResult, self).__init__(**kwargs) self.value = value diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_dns_forwarding_rulesets_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_dns_forwarding_rulesets_operations.py index a3a29c5c21f9..9b80bd88f7f9 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_dns_forwarding_rulesets_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_dns_forwarding_rulesets_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 @@ -40,39 +40,39 @@ def build_create_or_update_request_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}") # 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), "dnsForwardingRulesetName": _SERIALIZER.url("dns_forwarding_ruleset_name", dns_forwarding_ruleset_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') 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 @@ -89,37 +89,37 @@ def build_update_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}") # 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), "dnsForwardingRulesetName": _SERIALIZER.url("dns_forwarding_ruleset_name", dns_forwarding_ruleset_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') 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 @@ -134,33 +134,34 @@ def build_delete_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}") # 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), "dnsForwardingRulesetName": _SERIALIZER.url("dns_forwarding_ruleset_name", dns_forwarding_ruleset_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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 ) @@ -171,31 +172,32 @@ def build_get_request( dns_forwarding_ruleset_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}") # 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), "dnsForwardingRulesetName": _SERIALIZER.url("dns_forwarding_ruleset_name", dns_forwarding_ruleset_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 ) @@ -207,32 +209,33 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets") # 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') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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 ) @@ -243,31 +246,32 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets") 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 top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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,33 +284,34 @@ def build_list_by_virtual_network_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsForwardingRulesets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsForwardingRulesets") # 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), "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_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') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -317,7 +322,7 @@ class DnsForwardingRulesetsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -347,6 +352,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DnsForwardingRuleset') @@ -355,6 +361,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -364,7 +371,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]: @@ -383,7 +394,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace @@ -403,13 +414,13 @@ def begin_create_or_update( :param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. :type dns_forwarding_ruleset_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.DnsForwardingRuleset + :type parameters: ~azure.mgmt.dnsresolver.models.DnsForwardingRuleset :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -421,12 +432,12 @@ def begin_create_or_update( Retry-After header is present. :return: An instance of LROPoller that returns either DnsForwardingRuleset or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.DnsForwardingRuleset] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.DnsForwardingRuleset"] lro_delay = kwargs.pop( 'polling_interval', @@ -440,6 +451,7 @@ def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -464,10 +476,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore def _update_initial( self, @@ -483,6 +494,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DnsForwardingRulesetPatch') @@ -491,6 +503,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -499,7 +512,11 @@ def _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]: @@ -515,7 +532,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace @@ -534,10 +551,10 @@ def begin_update( :param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. :type dns_forwarding_ruleset_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.DnsForwardingRulesetPatch + :type parameters: ~azure.mgmt.dnsresolver.models.DnsForwardingRulesetPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -549,12 +566,12 @@ def begin_update( Retry-After header is present. :return: An instance of LROPoller that returns either DnsForwardingRuleset or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.DnsForwardingRuleset] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.DnsForwardingRuleset] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.DnsForwardingRuleset"] lro_delay = kwargs.pop( 'polling_interval', @@ -567,6 +584,7 @@ def begin_update( dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -591,12 +609,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -609,18 +626,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, if_match=if_match, 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]: @@ -630,11 +654,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -650,7 +674,7 @@ def begin_delete( :type dns_forwarding_ruleset_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -664,7 +688,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', "2020-04-01-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', @@ -676,6 +701,7 @@ def begin_delete( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -696,10 +722,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.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace def get( @@ -716,7 +741,7 @@ def get( :type dns_forwarding_ruleset_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DnsForwardingRuleset, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.DnsForwardingRuleset + :rtype: ~azure.mgmt.dnsresolver.models.DnsForwardingRuleset :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsForwardingRuleset"] @@ -725,17 +750,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_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]: @@ -749,7 +781,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}"} # type: ignore @distributed_trace @@ -764,15 +796,17 @@ 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 top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DnsForwardingRulesetListResult or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.DnsForwardingRulesetListResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.DnsForwardingRulesetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsForwardingRulesetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -784,6 +818,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, top=top, template_url=self.list_by_resource_group.metadata['url'], ) @@ -795,6 +830,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, top=top, template_url=next_link, ) @@ -813,7 +849,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]: @@ -826,7 +866,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.Network/dnsForwardingRulesets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets"} # type: ignore @distributed_trace def list( @@ -837,15 +877,17 @@ def list( """Lists DNS forwarding rulesets in all resource groups of a subscription. :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DnsForwardingRulesetListResult or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.DnsForwardingRulesetListResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.DnsForwardingRulesetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsForwardingRulesetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -856,6 +898,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -866,6 +909,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, top=top, template_url=next_link, ) @@ -884,7 +928,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]: @@ -897,7 +945,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets"} # type: ignore @distributed_trace def list_by_virtual_network( @@ -914,15 +962,17 @@ def list_by_virtual_network( :param virtual_network_name: The name of the virtual network. :type virtual_network_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkDnsForwardingRulesetListResult or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.VirtualNetworkDnsForwardingRulesetListResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.VirtualNetworkDnsForwardingRulesetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkDnsForwardingRulesetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -935,6 +985,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, + api_version=api_version, top=top, template_url=self.list_by_virtual_network.metadata['url'], ) @@ -947,6 +998,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -965,7 +1017,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]: @@ -978,4 +1034,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsForwardingRulesets'} # type: ignore + list_by_virtual_network.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsForwardingRulesets"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_dns_resolvers_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_dns_resolvers_operations.py index cd7d2ca91626..444018d4c2e4 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_dns_resolvers_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_dns_resolvers_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 @@ -40,39 +40,39 @@ def build_create_or_update_request_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}") # 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), "dnsResolverName": _SERIALIZER.url("dns_resolver_name", dns_resolver_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') 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 @@ -89,37 +89,37 @@ def build_update_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}") # 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), "dnsResolverName": _SERIALIZER.url("dns_resolver_name", dns_resolver_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') 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 @@ -134,33 +134,34 @@ def build_delete_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}") # 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), "dnsResolverName": _SERIALIZER.url("dns_resolver_name", dns_resolver_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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 ) @@ -171,31 +172,32 @@ def build_get_request( dns_resolver_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}") # 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), "dnsResolverName": _SERIALIZER.url("dns_resolver_name", dns_resolver_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 ) @@ -207,32 +209,33 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers") # 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') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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 ) @@ -243,31 +246,32 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers") 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 top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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,33 +284,34 @@ def build_list_by_virtual_network_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsResolvers') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsResolvers") # 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), "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_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') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -317,7 +322,7 @@ class DnsResolversOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -347,6 +352,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DnsResolver') @@ -355,6 +361,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -364,7 +371,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]: @@ -383,7 +394,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace @@ -403,13 +414,13 @@ def begin_create_or_update( :param dns_resolver_name: The name of the DNS resolver. :type dns_resolver_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.DnsResolver + :type parameters: ~azure.mgmt.dnsresolver.models.DnsResolver :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -421,11 +432,12 @@ def begin_create_or_update( Retry-After header is present. :return: An instance of LROPoller that returns either DnsResolver or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.DnsResolver] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.DnsResolver] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.DnsResolver"] lro_delay = kwargs.pop( 'polling_interval', @@ -439,6 +451,7 @@ def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -463,10 +476,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore def _update_initial( self, @@ -482,6 +494,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DnsResolverPatch') @@ -490,6 +503,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -498,7 +512,11 @@ def _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]: @@ -514,7 +532,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace @@ -533,10 +551,10 @@ def begin_update( :param dns_resolver_name: The name of the DNS resolver. :type dns_resolver_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.DnsResolverPatch + :type parameters: ~azure.mgmt.dnsresolver.models.DnsResolverPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -548,11 +566,12 @@ def begin_update( Retry-After header is present. :return: An instance of LROPoller that returns either DnsResolver or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.DnsResolver] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.DnsResolver] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.DnsResolver"] lro_delay = kwargs.pop( 'polling_interval', @@ -565,6 +584,7 @@ def begin_update( dns_resolver_name=dns_resolver_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -589,12 +609,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -607,18 +626,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, if_match=if_match, 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]: @@ -628,11 +654,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -647,7 +673,7 @@ def begin_delete( :type dns_resolver_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -661,7 +687,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', "2020-04-01-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', @@ -673,6 +700,7 @@ def begin_delete( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -693,10 +721,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.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace def get( @@ -713,7 +740,7 @@ def get( :type dns_resolver_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DnsResolver, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.DnsResolver + :rtype: ~azure.mgmt.dnsresolver.models.DnsResolver :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsResolver"] @@ -722,17 +749,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_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]: @@ -746,7 +780,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"} # type: ignore @distributed_trace @@ -761,15 +795,16 @@ 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 top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DnsResolverListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.DnsResolverListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.DnsResolverListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsResolverListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -781,6 +816,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, top=top, template_url=self.list_by_resource_group.metadata['url'], ) @@ -792,6 +828,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, top=top, template_url=next_link, ) @@ -810,7 +847,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]: @@ -823,7 +864,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.Network/dnsResolvers'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers"} # type: ignore @distributed_trace def list( @@ -834,15 +875,16 @@ def list( """Lists DNS resolvers in all resource groups of a subscription. :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DnsResolverListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.DnsResolverListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.DnsResolverListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DnsResolverListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -853,6 +895,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -863,6 +906,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, top=top, template_url=next_link, ) @@ -881,7 +925,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]: @@ -894,7 +942,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers"} # type: ignore @distributed_trace def list_by_virtual_network( @@ -911,15 +959,16 @@ def list_by_virtual_network( :param virtual_network_name: The name of the virtual network. :type virtual_network_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubResourceListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.SubResourceListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.SubResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -932,6 +981,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, + api_version=api_version, top=top, template_url=self.list_by_virtual_network.metadata['url'], ) @@ -944,6 +994,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -962,7 +1013,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]: @@ -975,4 +1030,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsResolvers'} # type: ignore + list_by_virtual_network.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsResolvers"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_forwarding_rules_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_forwarding_rules_operations.py index 99badcbf9bf6..1abca49a18b4 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_forwarding_rules_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_forwarding_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 @@ -39,12 +39,12 @@ def build_create_or_update_request( if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}") # 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), @@ -52,27 +52,27 @@ def build_create_or_update_request( "forwardingRuleName": _SERIALIZER.url("forwarding_rule_name", forwarding_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') 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 @@ -90,12 +90,12 @@ def build_update_request( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}") # 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), @@ -103,25 +103,25 @@ def build_update_request( "forwardingRuleName": _SERIALIZER.url("forwarding_rule_name", forwarding_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') 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 @@ -137,10 +137,11 @@ def build_delete_request( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}") # 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), @@ -148,23 +149,23 @@ def build_delete_request( "forwardingRuleName": _SERIALIZER.url("forwarding_rule_name", forwarding_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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 ) @@ -176,10 +177,11 @@ def build_get_request( forwarding_rule_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}") # 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), @@ -187,21 +189,21 @@ def build_get_request( "forwardingRuleName": _SERIALIZER.url("forwarding_rule_name", forwarding_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 ) @@ -214,33 +216,34 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules") # 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), "dnsForwardingRulesetName": _SERIALIZER.url("dns_forwarding_ruleset_name", dns_forwarding_ruleset_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') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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 ) @@ -251,7 +254,7 @@ class ForwardingRulesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -286,17 +289,17 @@ def create_or_update( :param forwarding_rule_name: The name of the forwarding rule. :type forwarding_rule_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.ForwardingRule + :type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRule :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ForwardingRule, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.ForwardingRule + :rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ForwardingRule"] @@ -305,6 +308,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ForwardingRule') @@ -314,6 +318,7 @@ def create_or_update( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, forwarding_rule_name=forwarding_rule_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -323,7 +328,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]: @@ -341,7 +350,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"} # type: ignore @distributed_trace @@ -363,14 +372,14 @@ def update( :param forwarding_rule_name: The name of the forwarding rule. :type forwarding_rule_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.ForwardingRulePatch + :type parameters: ~azure.mgmt.dnsresolver.models.ForwardingRulePatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ForwardingRule, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.ForwardingRule + :rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ForwardingRule"] @@ -379,6 +388,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ForwardingRulePatch') @@ -388,6 +398,7 @@ def update( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, forwarding_rule_name=forwarding_rule_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -396,7 +407,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]: @@ -410,11 +425,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -433,7 +448,7 @@ def delete( :type forwarding_rule_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -446,19 +461,26 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, forwarding_rule_name=forwarding_rule_name, + api_version=api_version, if_match=if_match, 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]: @@ -468,7 +490,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"} # type: ignore @distributed_trace @@ -489,7 +511,7 @@ def get( :type forwarding_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ForwardingRule, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.ForwardingRule + :rtype: ~azure.mgmt.dnsresolver.models.ForwardingRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ForwardingRule"] @@ -498,18 +520,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, forwarding_rule_name=forwarding_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]: @@ -523,7 +552,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName}"} # type: ignore @distributed_trace @@ -541,15 +570,16 @@ def list( :param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. :type dns_forwarding_ruleset_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ForwardingRuleListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.ForwardingRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.ForwardingRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ForwardingRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -562,6 +592,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -574,6 +605,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -592,7 +624,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]: @@ -605,4 +641,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_inbound_endpoints_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_inbound_endpoints_operations.py index 089454583f18..cf353d04f42a 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_inbound_endpoints_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_inbound_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, 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 @@ -41,12 +41,12 @@ def build_create_or_update_request_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}") # 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), @@ -54,27 +54,27 @@ def build_create_or_update_request_initial( "inboundEndpointName": _SERIALIZER.url("inbound_endpoint_name", inbound_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') 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 @@ -92,12 +92,12 @@ def build_update_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}") # 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), @@ -105,25 +105,25 @@ def build_update_request_initial( "inboundEndpointName": _SERIALIZER.url("inbound_endpoint_name", inbound_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') 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 @@ -139,10 +139,11 @@ def build_delete_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}") # 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), @@ -150,23 +151,23 @@ def build_delete_request_initial( "inboundEndpointName": _SERIALIZER.url("inbound_endpoint_name", inbound_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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 ) @@ -178,10 +179,11 @@ def build_get_request( inbound_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}") # 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), @@ -189,21 +191,21 @@ def build_get_request( "inboundEndpointName": _SERIALIZER.url("inbound_endpoint_name", inbound_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 ) @@ -216,33 +218,34 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints") # 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), "dnsResolverName": _SERIALIZER.url("dns_resolver_name", dns_resolver_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') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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 ) @@ -253,7 +256,7 @@ class InboundEndpointsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -284,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'InboundEndpoint') @@ -293,6 +297,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -302,7 +307,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]: @@ -321,7 +330,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace @@ -344,13 +353,13 @@ def begin_create_or_update( :param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. :type inbound_endpoint_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.InboundEndpoint + :type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpoint :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -362,11 +371,12 @@ def begin_create_or_update( Retry-After header is present. :return: An instance of LROPoller that returns either InboundEndpoint or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.InboundEndpoint] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.InboundEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -381,6 +391,7 @@ def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -405,10 +416,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore def _update_initial( self, @@ -425,6 +435,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'InboundEndpointPatch') @@ -434,6 +445,7 @@ def _update_initial( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -442,7 +454,11 @@ def _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]: @@ -458,7 +474,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace @@ -480,10 +496,10 @@ def begin_update( :param inbound_endpoint_name: The name of the inbound endpoint for the DNS resolver. :type inbound_endpoint_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.InboundEndpointPatch + :type parameters: ~azure.mgmt.dnsresolver.models.InboundEndpointPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -495,11 +511,12 @@ def begin_update( Retry-After header is present. :return: An instance of LROPoller that returns either InboundEndpoint or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.InboundEndpoint] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.InboundEndpoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.InboundEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +530,7 @@ def begin_update( inbound_endpoint_name=inbound_endpoint_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -537,12 +555,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -556,19 +573,26 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_endpoint_name, + api_version=api_version, if_match=if_match, 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]: @@ -578,11 +602,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -600,7 +624,7 @@ def begin_delete( :type inbound_endpoint_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -614,7 +638,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', "2020-04-01-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', @@ -627,6 +652,7 @@ def begin_delete( dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_endpoint_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -647,10 +673,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.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace def get( @@ -670,7 +695,7 @@ def get( :type inbound_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: InboundEndpoint, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.InboundEndpoint + :rtype: ~azure.mgmt.dnsresolver.models.InboundEndpoint :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.InboundEndpoint"] @@ -679,18 +704,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, inbound_endpoint_name=inbound_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]: @@ -704,7 +736,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"} # type: ignore @distributed_trace @@ -722,15 +754,16 @@ def list( :param dns_resolver_name: The name of the DNS resolver. :type dns_resolver_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either InboundEndpointListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.InboundEndpointListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.InboundEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.InboundEndpointListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -743,6 +776,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -755,6 +789,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -773,7 +808,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]: @@ -786,4 +825,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_outbound_endpoints_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_outbound_endpoints_operations.py index b5bc0e76e761..70e18bcc4abf 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_outbound_endpoints_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_outbound_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, 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 @@ -41,12 +41,12 @@ def build_create_or_update_request_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}") # 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), @@ -54,27 +54,27 @@ def build_create_or_update_request_initial( "outboundEndpointName": _SERIALIZER.url("outbound_endpoint_name", outbound_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') 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 @@ -92,12 +92,12 @@ def build_update_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}") # 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), @@ -105,25 +105,25 @@ def build_update_request_initial( "outboundEndpointName": _SERIALIZER.url("outbound_endpoint_name", outbound_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') 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 @@ -139,10 +139,11 @@ def build_delete_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}") # 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), @@ -150,23 +151,23 @@ def build_delete_request_initial( "outboundEndpointName": _SERIALIZER.url("outbound_endpoint_name", outbound_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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 ) @@ -178,10 +179,11 @@ def build_get_request( outbound_endpoint_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}") # 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), @@ -189,21 +191,21 @@ def build_get_request( "outboundEndpointName": _SERIALIZER.url("outbound_endpoint_name", outbound_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 ) @@ -216,33 +218,34 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints") # 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), "dnsResolverName": _SERIALIZER.url("dns_resolver_name", dns_resolver_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') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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 ) @@ -253,7 +256,7 @@ class OutboundEndpointsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -284,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OutboundEndpoint') @@ -293,6 +297,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -302,7 +307,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]: @@ -321,7 +330,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace @@ -344,13 +353,13 @@ def begin_create_or_update( :param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver. :type outbound_endpoint_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.OutboundEndpoint + :type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpoint :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -362,11 +371,12 @@ def begin_create_or_update( Retry-After header is present. :return: An instance of LROPoller that returns either OutboundEndpoint or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.OutboundEndpoint] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.OutboundEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -381,6 +391,7 @@ def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -405,10 +416,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore def _update_initial( self, @@ -425,6 +435,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OutboundEndpointPatch') @@ -434,6 +445,7 @@ def _update_initial( resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_endpoint_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -442,7 +454,11 @@ def _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]: @@ -458,7 +474,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace @@ -480,10 +496,10 @@ def begin_update( :param outbound_endpoint_name: The name of the outbound endpoint for the DNS resolver. :type outbound_endpoint_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.OutboundEndpointPatch + :type parameters: ~azure.mgmt.dnsresolver.models.OutboundEndpointPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -495,11 +511,12 @@ def begin_update( Retry-After header is present. :return: An instance of LROPoller that returns either OutboundEndpoint or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.OutboundEndpoint] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.OutboundEndpoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.OutboundEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +530,7 @@ def begin_update( outbound_endpoint_name=outbound_endpoint_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -537,12 +555,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -556,19 +573,26 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_endpoint_name, + api_version=api_version, if_match=if_match, 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]: @@ -578,11 +602,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_resolver_name: str, @@ -600,7 +624,7 @@ def begin_delete( :type outbound_endpoint_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -614,7 +638,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', "2020-04-01-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', @@ -627,6 +652,7 @@ def begin_delete( dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_endpoint_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -647,10 +673,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.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace def get( @@ -670,7 +695,7 @@ def get( :type outbound_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: OutboundEndpoint, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.OutboundEndpoint + :rtype: ~azure.mgmt.dnsresolver.models.OutboundEndpoint :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEndpoint"] @@ -679,18 +704,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, outbound_endpoint_name=outbound_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]: @@ -704,7 +736,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"} # type: ignore @distributed_trace @@ -722,15 +754,16 @@ def list( :param dns_resolver_name: The name of the DNS resolver. :type dns_resolver_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OutboundEndpointListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.OutboundEndpointListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.OutboundEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEndpointListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -743,6 +776,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -755,6 +789,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_resolver_name=dns_resolver_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -773,7 +808,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]: @@ -786,4 +825,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints"} # type: ignore diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_virtual_network_links_operations.py b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_virtual_network_links_operations.py index 3354a7b1f9bf..7e4760866c77 100644 --- a/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_virtual_network_links_operations.py +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/azure/mgmt/dnsresolver/operations/_virtual_network_links_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 @@ -41,12 +41,12 @@ def build_create_or_update_request_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}") # 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), @@ -54,27 +54,27 @@ def build_create_or_update_request_initial( "virtualNetworkLinkName": _SERIALIZER.url("virtual_network_link_name", virtual_network_link_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if if_none_match is not None: - header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') 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 @@ -92,12 +92,12 @@ def build_update_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-04-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}") # 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), @@ -105,25 +105,25 @@ def build_update_request_initial( "virtualNetworkLinkName": _SERIALIZER.url("virtual_network_link_name", virtual_network_link_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') 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 @@ -139,10 +139,11 @@ def build_delete_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}") # 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), @@ -150,23 +151,23 @@ def build_delete_request_initial( "virtualNetworkLinkName": _SERIALIZER.url("virtual_network_link_name", virtual_network_link_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 if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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 ) @@ -178,10 +179,11 @@ def build_get_request( virtual_network_link_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}") # 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), @@ -189,21 +191,21 @@ def build_get_request( "virtualNetworkLinkName": _SERIALIZER.url("virtual_network_link_name", virtual_network_link_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 ) @@ -216,33 +218,34 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-04-01-preview" + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks") # 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), "dnsForwardingRulesetName": _SERIALIZER.url("dns_forwarding_ruleset_name", dns_forwarding_ruleset_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') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') # 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 ) @@ -253,7 +256,7 @@ class VirtualNetworkLinksOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~dns_resolver_management_client.models + :type models: ~azure.mgmt.dnsresolver.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -284,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualNetworkLink') @@ -293,6 +297,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -302,7 +307,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]: @@ -321,7 +330,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace @@ -344,13 +353,13 @@ def begin_create_or_update( :param virtual_network_link_name: The name of the virtual network link. :type virtual_network_link_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. - :type parameters: ~dns_resolver_management_client.models.VirtualNetworkLink + :type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new resource to be created, but to prevent updating - an existing resource. Other values will be ignored. + an existing resource. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -362,12 +371,12 @@ def begin_create_or_update( Retry-After header is present. :return: An instance of LROPoller that returns either VirtualNetworkLink or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.VirtualNetworkLink] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.VirtualNetworkLink"] lro_delay = kwargs.pop( 'polling_interval', @@ -382,6 +391,7 @@ def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -406,10 +416,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_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore def _update_initial( self, @@ -426,6 +435,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualNetworkLinkPatch') @@ -435,6 +445,7 @@ def _update_initial( resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -443,7 +454,11 @@ def _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]: @@ -459,7 +474,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace @@ -481,10 +496,10 @@ def begin_update( :param virtual_network_link_name: The name of the virtual network link. :type virtual_network_link_name: str :param parameters: Parameters supplied to the Update operation. - :type parameters: ~dns_resolver_management_client.models.VirtualNetworkLinkPatch + :type parameters: ~azure.mgmt.dnsresolver.models.VirtualNetworkLinkPatch :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -496,12 +511,12 @@ def begin_update( Retry-After header is present. :return: An instance of LROPoller that returns either VirtualNetworkLink or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~dns_resolver_management_client.models.VirtualNetworkLink] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dnsresolver.models.VirtualNetworkLink] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-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.VirtualNetworkLink"] lro_delay = kwargs.pop( 'polling_interval', @@ -515,6 +530,7 @@ def begin_update( virtual_network_link_name=virtual_network_link_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -539,12 +555,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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -558,19 +573,26 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_name, + api_version=api_version, if_match=if_match, 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]: @@ -580,11 +602,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, dns_forwarding_ruleset_name: str, @@ -603,7 +625,7 @@ def begin_delete( :type virtual_network_link_name: str :param if_match: ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent - changes. + changes. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -617,7 +639,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', "2020-04-01-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', @@ -630,6 +653,7 @@ def begin_delete( dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_name, if_match=if_match, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -650,10 +674,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.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace def get( @@ -673,7 +696,7 @@ def get( :type virtual_network_link_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkLink, or the result of cls(response) - :rtype: ~dns_resolver_management_client.models.VirtualNetworkLink + :rtype: ~azure.mgmt.dnsresolver.models.VirtualNetworkLink :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLink"] @@ -682,18 +705,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, virtual_network_link_name=virtual_network_link_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]: @@ -707,7 +737,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"} # type: ignore @distributed_trace @@ -725,15 +755,17 @@ def list( :param dns_forwarding_ruleset_name: The name of the DNS forwarding ruleset. :type dns_forwarding_ruleset_name: str :param top: The maximum number of results to return. If not specified, returns up to 100 - results. + results. Default value is None. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkLinkListResult or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~dns_resolver_management_client.models.VirtualNetworkLinkListResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.dnsresolver.models.VirtualNetworkLinkListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkLinkListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -746,6 +778,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, top=top, template_url=self.list.metadata['url'], ) @@ -758,6 +791,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, dns_forwarding_ruleset_name=dns_forwarding_ruleset_name, + api_version=api_version, top=top, template_url=next_link, ) @@ -776,7 +810,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]: @@ -789,4 +827,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks"} # type: ignore