1# coding=utf-8
2# --------------------------------------------------------------------------
3# Copyright (c) Microsoft Corporation. All rights reserved.
4# Licensed under the MIT License. See License.txt in the project root for license information.
5# Code generated by Microsoft (R) AutoRest Code Generator.
6# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7# --------------------------------------------------------------------------
8from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union
9import warnings
10
11from azure.core.async_paging import AsyncItemPaged, AsyncList
12from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
13from azure.core.pipeline import PipelineResponse
14from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
15from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
16from azure.mgmt.core.exceptions import ARMErrorFormat
17from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
18
19from ... import models as _models
20
21T = TypeVar('T')
22ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
23
24class AppServiceEnvironmentsOperations:
25    """AppServiceEnvironmentsOperations async operations.
26
27    You should not instantiate this class directly. Instead, you should create a Client instance that
28    instantiates it for you and attaches it as an attribute.
29
30    :ivar models: Alias to model classes used in this operation group.
31    :type models: ~azure.mgmt.web.v2016_09_01.models
32    :param client: Client for service requests.
33    :param config: Configuration of service client.
34    :param serializer: An object model serializer.
35    :param deserializer: An object model deserializer.
36    """
37
38    models = _models
39
40    def __init__(self, client, config, serializer, deserializer) -> None:
41        self._client = client
42        self._serialize = serializer
43        self._deserialize = deserializer
44        self._config = config
45
46    def list(
47        self,
48        **kwargs: Any
49    ) -> AsyncIterable["_models.AppServiceEnvironmentCollection"]:
50        """Get all App Service Environments for a subscription.
51
52        Get all App Service Environments for a subscription.
53
54        :keyword callable cls: A custom type or function that will be passed the direct response
55        :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response)
56        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentCollection]
57        :raises: ~azure.core.exceptions.HttpResponseError
58        """
59        cls = kwargs.pop('cls', None)  # type: ClsType["_models.AppServiceEnvironmentCollection"]
60        error_map = {
61            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
62        }
63        error_map.update(kwargs.pop('error_map', {}))
64        api_version = "2016-09-01"
65        accept = "application/json"
66
67        def prepare_request(next_link=None):
68            # Construct headers
69            header_parameters = {}  # type: Dict[str, Any]
70            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
71
72            if not next_link:
73                # Construct URL
74                url = self.list.metadata['url']  # type: ignore
75                path_format_arguments = {
76                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
77                }
78                url = self._client.format_url(url, **path_format_arguments)
79                # Construct parameters
80                query_parameters = {}  # type: Dict[str, Any]
81                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
82
83                request = self._client.get(url, query_parameters, header_parameters)
84            else:
85                url = next_link
86                query_parameters = {}  # type: Dict[str, Any]
87                request = self._client.get(url, query_parameters, header_parameters)
88            return request
89
90        async def extract_data(pipeline_response):
91            deserialized = self._deserialize('AppServiceEnvironmentCollection', pipeline_response)
92            list_of_elem = deserialized.value
93            if cls:
94                list_of_elem = cls(list_of_elem)
95            return deserialized.next_link or None, AsyncList(list_of_elem)
96
97        async def get_next(next_link=None):
98            request = prepare_request(next_link)
99
100            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
101            response = pipeline_response.http_response
102
103            if response.status_code not in [200]:
104                map_error(status_code=response.status_code, response=response, error_map=error_map)
105                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
106
107            return pipeline_response
108
109        return AsyncItemPaged(
110            get_next, extract_data
111        )
112    list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments'}  # type: ignore
113
114    def list_by_resource_group(
115        self,
116        resource_group_name: str,
117        **kwargs: Any
118    ) -> AsyncIterable["_models.AppServiceEnvironmentCollection"]:
119        """Get all App Service Environments in a resource group.
120
121        Get all App Service Environments in a resource group.
122
123        :param resource_group_name: Name of the resource group to which the resource belongs.
124        :type resource_group_name: str
125        :keyword callable cls: A custom type or function that will be passed the direct response
126        :return: An iterator like instance of either AppServiceEnvironmentCollection or the result of cls(response)
127        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentCollection]
128        :raises: ~azure.core.exceptions.HttpResponseError
129        """
130        cls = kwargs.pop('cls', None)  # type: ClsType["_models.AppServiceEnvironmentCollection"]
131        error_map = {
132            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
133        }
134        error_map.update(kwargs.pop('error_map', {}))
135        api_version = "2016-09-01"
136        accept = "application/json"
137
138        def prepare_request(next_link=None):
139            # Construct headers
140            header_parameters = {}  # type: Dict[str, Any]
141            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
142
143            if not next_link:
144                # Construct URL
145                url = self.list_by_resource_group.metadata['url']  # type: ignore
146                path_format_arguments = {
147                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
148                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
149                }
150                url = self._client.format_url(url, **path_format_arguments)
151                # Construct parameters
152                query_parameters = {}  # type: Dict[str, Any]
153                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
154
155                request = self._client.get(url, query_parameters, header_parameters)
156            else:
157                url = next_link
158                query_parameters = {}  # type: Dict[str, Any]
159                request = self._client.get(url, query_parameters, header_parameters)
160            return request
161
162        async def extract_data(pipeline_response):
163            deserialized = self._deserialize('AppServiceEnvironmentCollection', pipeline_response)
164            list_of_elem = deserialized.value
165            if cls:
166                list_of_elem = cls(list_of_elem)
167            return deserialized.next_link or None, AsyncList(list_of_elem)
168
169        async def get_next(next_link=None):
170            request = prepare_request(next_link)
171
172            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
173            response = pipeline_response.http_response
174
175            if response.status_code not in [200]:
176                map_error(status_code=response.status_code, response=response, error_map=error_map)
177                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
178
179            return pipeline_response
180
181        return AsyncItemPaged(
182            get_next, extract_data
183        )
184    list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments'}  # type: ignore
185
186    async def get(
187        self,
188        resource_group_name: str,
189        name: str,
190        **kwargs: Any
191    ) -> "_models.AppServiceEnvironmentResource":
192        """Get the properties of an App Service Environment.
193
194        Get the properties of an App Service Environment.
195
196        :param resource_group_name: Name of the resource group to which the resource belongs.
197        :type resource_group_name: str
198        :param name: Name of the App Service Environment.
199        :type name: str
200        :keyword callable cls: A custom type or function that will be passed the direct response
201        :return: AppServiceEnvironmentResource, or the result of cls(response)
202        :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource
203        :raises: ~azure.core.exceptions.HttpResponseError
204        """
205        cls = kwargs.pop('cls', None)  # type: ClsType["_models.AppServiceEnvironmentResource"]
206        error_map = {
207            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
208        }
209        error_map.update(kwargs.pop('error_map', {}))
210        api_version = "2016-09-01"
211        accept = "application/json"
212
213        # Construct URL
214        url = self.get.metadata['url']  # type: ignore
215        path_format_arguments = {
216            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
217            'name': self._serialize.url("name", name, 'str'),
218            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
219        }
220        url = self._client.format_url(url, **path_format_arguments)
221
222        # Construct parameters
223        query_parameters = {}  # type: Dict[str, Any]
224        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
225
226        # Construct headers
227        header_parameters = {}  # type: Dict[str, Any]
228        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
229
230        request = self._client.get(url, query_parameters, header_parameters)
231        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
232        response = pipeline_response.http_response
233
234        if response.status_code not in [200]:
235            map_error(status_code=response.status_code, response=response, error_map=error_map)
236            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
237
238        deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response)
239
240        if cls:
241            return cls(pipeline_response, deserialized, {})
242
243        return deserialized
244    get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'}  # type: ignore
245
246    async def _create_or_update_initial(
247        self,
248        resource_group_name: str,
249        name: str,
250        hosting_environment_envelope: "_models.AppServiceEnvironmentResource",
251        **kwargs: Any
252    ) -> Optional["_models.AppServiceEnvironmentResource"]:
253        cls = kwargs.pop('cls', None)  # type: ClsType[Optional["_models.AppServiceEnvironmentResource"]]
254        error_map = {
255            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
256        }
257        error_map.update(kwargs.pop('error_map', {}))
258        api_version = "2016-09-01"
259        content_type = kwargs.pop("content_type", "application/json")
260        accept = "application/json"
261
262        # Construct URL
263        url = self._create_or_update_initial.metadata['url']  # type: ignore
264        path_format_arguments = {
265            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
266            'name': self._serialize.url("name", name, 'str'),
267            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
268        }
269        url = self._client.format_url(url, **path_format_arguments)
270
271        # Construct parameters
272        query_parameters = {}  # type: Dict[str, Any]
273        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
274
275        # Construct headers
276        header_parameters = {}  # type: Dict[str, Any]
277        header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
278        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
279
280        body_content_kwargs = {}  # type: Dict[str, Any]
281        body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentResource')
282        body_content_kwargs['content'] = body_content
283        request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
284        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
285        response = pipeline_response.http_response
286
287        if response.status_code not in [200, 202, 400, 404, 409]:
288            map_error(status_code=response.status_code, response=response, error_map=error_map)
289            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
290
291        deserialized = None
292        if response.status_code == 200:
293            deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response)
294
295        if response.status_code == 202:
296            deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response)
297
298        if cls:
299            return cls(pipeline_response, deserialized, {})
300
301        return deserialized
302    _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'}  # type: ignore
303
304    async def begin_create_or_update(
305        self,
306        resource_group_name: str,
307        name: str,
308        hosting_environment_envelope: "_models.AppServiceEnvironmentResource",
309        **kwargs: Any
310    ) -> AsyncLROPoller["_models.AppServiceEnvironmentResource"]:
311        """Create or update an App Service Environment.
312
313        Create or update an App Service Environment.
314
315        :param resource_group_name: Name of the resource group to which the resource belongs.
316        :type resource_group_name: str
317        :param name: Name of the App Service Environment.
318        :type name: str
319        :param hosting_environment_envelope: Configuration details of the App Service Environment.
320        :type hosting_environment_envelope: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource
321        :keyword callable cls: A custom type or function that will be passed the direct response
322        :keyword str continuation_token: A continuation token to restart a poller from a saved state.
323        :keyword polling: By default, your polling method will be AsyncARMPolling.
324         Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
325        :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
326        :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
327        :return: An instance of AsyncLROPoller that returns either AppServiceEnvironmentResource or the result of cls(response)
328        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource]
329        :raises ~azure.core.exceptions.HttpResponseError:
330        """
331        polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
332        cls = kwargs.pop('cls', None)  # type: ClsType["_models.AppServiceEnvironmentResource"]
333        lro_delay = kwargs.pop(
334            'polling_interval',
335            self._config.polling_interval
336        )
337        cont_token = kwargs.pop('continuation_token', None)  # type: Optional[str]
338        if cont_token is None:
339            raw_result = await self._create_or_update_initial(
340                resource_group_name=resource_group_name,
341                name=name,
342                hosting_environment_envelope=hosting_environment_envelope,
343                cls=lambda x,y,z: x,
344                **kwargs
345            )
346
347        kwargs.pop('error_map', None)
348        kwargs.pop('content_type', None)
349
350        def get_long_running_output(pipeline_response):
351            deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response)
352
353            if cls:
354                return cls(pipeline_response, deserialized, {})
355            return deserialized
356
357        path_format_arguments = {
358            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
359            'name': self._serialize.url("name", name, 'str'),
360            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
361        }
362
363        if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
364        elif polling is False: polling_method = AsyncNoPolling()
365        else: polling_method = polling
366        if cont_token:
367            return AsyncLROPoller.from_continuation_token(
368                polling_method=polling_method,
369                continuation_token=cont_token,
370                client=self._client,
371                deserialization_callback=get_long_running_output
372            )
373        else:
374            return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
375    begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'}  # type: ignore
376
377    async def _delete_initial(
378        self,
379        resource_group_name: str,
380        name: str,
381        force_delete: Optional[bool] = None,
382        **kwargs: Any
383    ) -> None:
384        cls = kwargs.pop('cls', None)  # type: ClsType[None]
385        error_map = {
386            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
387        }
388        error_map.update(kwargs.pop('error_map', {}))
389        api_version = "2016-09-01"
390
391        # Construct URL
392        url = self._delete_initial.metadata['url']  # type: ignore
393        path_format_arguments = {
394            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
395            'name': self._serialize.url("name", name, 'str'),
396            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
397        }
398        url = self._client.format_url(url, **path_format_arguments)
399
400        # Construct parameters
401        query_parameters = {}  # type: Dict[str, Any]
402        if force_delete is not None:
403            query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool')
404        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
405
406        # Construct headers
407        header_parameters = {}  # type: Dict[str, Any]
408
409        request = self._client.delete(url, query_parameters, header_parameters)
410        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
411        response = pipeline_response.http_response
412
413        if response.status_code not in [202, 204, 400, 404, 409]:
414            map_error(status_code=response.status_code, response=response, error_map=error_map)
415            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
416
417        if cls:
418            return cls(pipeline_response, None, {})
419
420    _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'}  # type: ignore
421
422    async def begin_delete(
423        self,
424        resource_group_name: str,
425        name: str,
426        force_delete: Optional[bool] = None,
427        **kwargs: Any
428    ) -> AsyncLROPoller[None]:
429        """Delete an App Service Environment.
430
431        Delete an App Service Environment.
432
433        :param resource_group_name: Name of the resource group to which the resource belongs.
434        :type resource_group_name: str
435        :param name: Name of the App Service Environment.
436        :type name: str
437        :param force_delete: Specify :code:`<code>true</code>` to force the deletion even if the App
438         Service Environment contains resources. The default is :code:`<code>false</code>`.
439        :type force_delete: bool
440        :keyword callable cls: A custom type or function that will be passed the direct response
441        :keyword str continuation_token: A continuation token to restart a poller from a saved state.
442        :keyword polling: By default, your polling method will be AsyncARMPolling.
443         Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
444        :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
445        :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
446        :return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
447        :rtype: ~azure.core.polling.AsyncLROPoller[None]
448        :raises ~azure.core.exceptions.HttpResponseError:
449        """
450        polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
451        cls = kwargs.pop('cls', None)  # type: ClsType[None]
452        lro_delay = kwargs.pop(
453            'polling_interval',
454            self._config.polling_interval
455        )
456        cont_token = kwargs.pop('continuation_token', None)  # type: Optional[str]
457        if cont_token is None:
458            raw_result = await self._delete_initial(
459                resource_group_name=resource_group_name,
460                name=name,
461                force_delete=force_delete,
462                cls=lambda x,y,z: x,
463                **kwargs
464            )
465
466        kwargs.pop('error_map', None)
467        kwargs.pop('content_type', None)
468
469        def get_long_running_output(pipeline_response):
470            if cls:
471                return cls(pipeline_response, None, {})
472
473        path_format_arguments = {
474            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
475            'name': self._serialize.url("name", name, 'str'),
476            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
477        }
478
479        if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
480        elif polling is False: polling_method = AsyncNoPolling()
481        else: polling_method = polling
482        if cont_token:
483            return AsyncLROPoller.from_continuation_token(
484                polling_method=polling_method,
485                continuation_token=cont_token,
486                client=self._client,
487                deserialization_callback=get_long_running_output
488            )
489        else:
490            return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
491    begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'}  # type: ignore
492
493    async def update(
494        self,
495        resource_group_name: str,
496        name: str,
497        hosting_environment_envelope: "_models.AppServiceEnvironmentPatchResource",
498        **kwargs: Any
499    ) -> Optional["_models.AppServiceEnvironmentResource"]:
500        """Create or update an App Service Environment.
501
502        Create or update an App Service Environment.
503
504        :param resource_group_name: Name of the resource group to which the resource belongs.
505        :type resource_group_name: str
506        :param name: Name of the App Service Environment.
507        :type name: str
508        :param hosting_environment_envelope: Configuration details of the App Service Environment.
509        :type hosting_environment_envelope: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentPatchResource
510        :keyword callable cls: A custom type or function that will be passed the direct response
511        :return: AppServiceEnvironmentResource, or the result of cls(response)
512        :rtype: ~azure.mgmt.web.v2016_09_01.models.AppServiceEnvironmentResource or None
513        :raises: ~azure.core.exceptions.HttpResponseError
514        """
515        cls = kwargs.pop('cls', None)  # type: ClsType[Optional["_models.AppServiceEnvironmentResource"]]
516        error_map = {
517            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
518        }
519        error_map.update(kwargs.pop('error_map', {}))
520        api_version = "2016-09-01"
521        content_type = kwargs.pop("content_type", "application/json")
522        accept = "application/json"
523
524        # Construct URL
525        url = self.update.metadata['url']  # type: ignore
526        path_format_arguments = {
527            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
528            'name': self._serialize.url("name", name, 'str'),
529            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
530        }
531        url = self._client.format_url(url, **path_format_arguments)
532
533        # Construct parameters
534        query_parameters = {}  # type: Dict[str, Any]
535        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
536
537        # Construct headers
538        header_parameters = {}  # type: Dict[str, Any]
539        header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
540        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
541
542        body_content_kwargs = {}  # type: Dict[str, Any]
543        body_content = self._serialize.body(hosting_environment_envelope, 'AppServiceEnvironmentPatchResource')
544        body_content_kwargs['content'] = body_content
545        request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)
546        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
547        response = pipeline_response.http_response
548
549        if response.status_code not in [200, 202, 400, 404, 409]:
550            map_error(status_code=response.status_code, response=response, error_map=error_map)
551            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
552
553        deserialized = None
554        if response.status_code == 200:
555            deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response)
556
557        if response.status_code == 202:
558            deserialized = self._deserialize('AppServiceEnvironmentResource', pipeline_response)
559
560        if cls:
561            return cls(pipeline_response, deserialized, {})
562
563        return deserialized
564    update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}'}  # type: ignore
565
566    def list_capacities(
567        self,
568        resource_group_name: str,
569        name: str,
570        **kwargs: Any
571    ) -> AsyncIterable["_models.StampCapacityCollection"]:
572        """Get the used, available, and total worker capacity an App Service Environment.
573
574        Get the used, available, and total worker capacity an App Service Environment.
575
576        :param resource_group_name: Name of the resource group to which the resource belongs.
577        :type resource_group_name: str
578        :param name: Name of the App Service Environment.
579        :type name: str
580        :keyword callable cls: A custom type or function that will be passed the direct response
581        :return: An iterator like instance of either StampCapacityCollection or the result of cls(response)
582        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.StampCapacityCollection]
583        :raises: ~azure.core.exceptions.HttpResponseError
584        """
585        cls = kwargs.pop('cls', None)  # type: ClsType["_models.StampCapacityCollection"]
586        error_map = {
587            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
588        }
589        error_map.update(kwargs.pop('error_map', {}))
590        api_version = "2016-09-01"
591        accept = "application/json"
592
593        def prepare_request(next_link=None):
594            # Construct headers
595            header_parameters = {}  # type: Dict[str, Any]
596            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
597
598            if not next_link:
599                # Construct URL
600                url = self.list_capacities.metadata['url']  # type: ignore
601                path_format_arguments = {
602                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
603                    'name': self._serialize.url("name", name, 'str'),
604                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
605                }
606                url = self._client.format_url(url, **path_format_arguments)
607                # Construct parameters
608                query_parameters = {}  # type: Dict[str, Any]
609                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
610
611                request = self._client.get(url, query_parameters, header_parameters)
612            else:
613                url = next_link
614                query_parameters = {}  # type: Dict[str, Any]
615                request = self._client.get(url, query_parameters, header_parameters)
616            return request
617
618        async def extract_data(pipeline_response):
619            deserialized = self._deserialize('StampCapacityCollection', pipeline_response)
620            list_of_elem = deserialized.value
621            if cls:
622                list_of_elem = cls(list_of_elem)
623            return deserialized.next_link or None, AsyncList(list_of_elem)
624
625        async def get_next(next_link=None):
626            request = prepare_request(next_link)
627
628            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
629            response = pipeline_response.http_response
630
631            if response.status_code not in [200]:
632                map_error(status_code=response.status_code, response=response, error_map=error_map)
633                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
634
635            return pipeline_response
636
637        return AsyncItemPaged(
638            get_next, extract_data
639        )
640    list_capacities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute'}  # type: ignore
641
642    async def list_vips(
643        self,
644        resource_group_name: str,
645        name: str,
646        **kwargs: Any
647    ) -> "_models.AddressResponse":
648        """Get IP addresses assigned to an App Service Environment.
649
650        Get IP addresses assigned to an App Service Environment.
651
652        :param resource_group_name: Name of the resource group to which the resource belongs.
653        :type resource_group_name: str
654        :param name: Name of the App Service Environment.
655        :type name: str
656        :keyword callable cls: A custom type or function that will be passed the direct response
657        :return: AddressResponse, or the result of cls(response)
658        :rtype: ~azure.mgmt.web.v2016_09_01.models.AddressResponse
659        :raises: ~azure.core.exceptions.HttpResponseError
660        """
661        cls = kwargs.pop('cls', None)  # type: ClsType["_models.AddressResponse"]
662        error_map = {
663            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
664        }
665        error_map.update(kwargs.pop('error_map', {}))
666        api_version = "2016-09-01"
667        accept = "application/json"
668
669        # Construct URL
670        url = self.list_vips.metadata['url']  # type: ignore
671        path_format_arguments = {
672            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
673            'name': self._serialize.url("name", name, 'str'),
674            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
675        }
676        url = self._client.format_url(url, **path_format_arguments)
677
678        # Construct parameters
679        query_parameters = {}  # type: Dict[str, Any]
680        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
681
682        # Construct headers
683        header_parameters = {}  # type: Dict[str, Any]
684        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
685
686        request = self._client.get(url, query_parameters, header_parameters)
687        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
688        response = pipeline_response.http_response
689
690        if response.status_code not in [200]:
691            map_error(status_code=response.status_code, response=response, error_map=error_map)
692            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
693
694        deserialized = self._deserialize('AddressResponse', pipeline_response)
695
696        if cls:
697            return cls(pipeline_response, deserialized, {})
698
699        return deserialized
700    list_vips.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip'}  # type: ignore
701
702    async def list_diagnostics(
703        self,
704        resource_group_name: str,
705        name: str,
706        **kwargs: Any
707    ) -> List["_models.HostingEnvironmentDiagnostics"]:
708        """Get diagnostic information for an App Service Environment.
709
710        Get diagnostic information for an App Service Environment.
711
712        :param resource_group_name: Name of the resource group to which the resource belongs.
713        :type resource_group_name: str
714        :param name: Name of the App Service Environment.
715        :type name: str
716        :keyword callable cls: A custom type or function that will be passed the direct response
717        :return: list of HostingEnvironmentDiagnostics, or the result of cls(response)
718        :rtype: list[~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentDiagnostics]
719        :raises: ~azure.core.exceptions.HttpResponseError
720        """
721        cls = kwargs.pop('cls', None)  # type: ClsType[List["_models.HostingEnvironmentDiagnostics"]]
722        error_map = {
723            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
724        }
725        error_map.update(kwargs.pop('error_map', {}))
726        api_version = "2016-09-01"
727        accept = "application/json"
728
729        # Construct URL
730        url = self.list_diagnostics.metadata['url']  # type: ignore
731        path_format_arguments = {
732            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
733            'name': self._serialize.url("name", name, 'str'),
734            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
735        }
736        url = self._client.format_url(url, **path_format_arguments)
737
738        # Construct parameters
739        query_parameters = {}  # type: Dict[str, Any]
740        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
741
742        # Construct headers
743        header_parameters = {}  # type: Dict[str, Any]
744        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
745
746        request = self._client.get(url, query_parameters, header_parameters)
747        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
748        response = pipeline_response.http_response
749
750        if response.status_code not in [200]:
751            map_error(status_code=response.status_code, response=response, error_map=error_map)
752            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
753
754        deserialized = self._deserialize('[HostingEnvironmentDiagnostics]', pipeline_response)
755
756        if cls:
757            return cls(pipeline_response, deserialized, {})
758
759        return deserialized
760    list_diagnostics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics'}  # type: ignore
761
762    async def get_diagnostics_item(
763        self,
764        resource_group_name: str,
765        name: str,
766        diagnostics_name: str,
767        **kwargs: Any
768    ) -> "_models.HostingEnvironmentDiagnostics":
769        """Get a diagnostics item for an App Service Environment.
770
771        Get a diagnostics item for an App Service Environment.
772
773        :param resource_group_name: Name of the resource group to which the resource belongs.
774        :type resource_group_name: str
775        :param name: Name of the App Service Environment.
776        :type name: str
777        :param diagnostics_name: Name of the diagnostics item.
778        :type diagnostics_name: str
779        :keyword callable cls: A custom type or function that will be passed the direct response
780        :return: HostingEnvironmentDiagnostics, or the result of cls(response)
781        :rtype: ~azure.mgmt.web.v2016_09_01.models.HostingEnvironmentDiagnostics
782        :raises: ~azure.core.exceptions.HttpResponseError
783        """
784        cls = kwargs.pop('cls', None)  # type: ClsType["_models.HostingEnvironmentDiagnostics"]
785        error_map = {
786            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
787        }
788        error_map.update(kwargs.pop('error_map', {}))
789        api_version = "2016-09-01"
790        accept = "application/json"
791
792        # Construct URL
793        url = self.get_diagnostics_item.metadata['url']  # type: ignore
794        path_format_arguments = {
795            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
796            'name': self._serialize.url("name", name, 'str'),
797            'diagnosticsName': self._serialize.url("diagnostics_name", diagnostics_name, 'str'),
798            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
799        }
800        url = self._client.format_url(url, **path_format_arguments)
801
802        # Construct parameters
803        query_parameters = {}  # type: Dict[str, Any]
804        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
805
806        # Construct headers
807        header_parameters = {}  # type: Dict[str, Any]
808        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
809
810        request = self._client.get(url, query_parameters, header_parameters)
811        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
812        response = pipeline_response.http_response
813
814        if response.status_code not in [200]:
815            map_error(status_code=response.status_code, response=response, error_map=error_map)
816            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
817
818        deserialized = self._deserialize('HostingEnvironmentDiagnostics', pipeline_response)
819
820        if cls:
821            return cls(pipeline_response, deserialized, {})
822
823        return deserialized
824    get_diagnostics_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}'}  # type: ignore
825
826    async def list_metric_definitions(
827        self,
828        resource_group_name: str,
829        name: str,
830        **kwargs: Any
831    ) -> "_models.MetricDefinition":
832        """Get global metric definitions of an App Service Environment.
833
834        Get global metric definitions of an App Service Environment.
835
836        :param resource_group_name: Name of the resource group to which the resource belongs.
837        :type resource_group_name: str
838        :param name: Name of the App Service Environment.
839        :type name: str
840        :keyword callable cls: A custom type or function that will be passed the direct response
841        :return: MetricDefinition, or the result of cls(response)
842        :rtype: ~azure.mgmt.web.v2016_09_01.models.MetricDefinition
843        :raises: ~azure.core.exceptions.HttpResponseError
844        """
845        cls = kwargs.pop('cls', None)  # type: ClsType["_models.MetricDefinition"]
846        error_map = {
847            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
848        }
849        error_map.update(kwargs.pop('error_map', {}))
850        api_version = "2016-09-01"
851        accept = "application/json"
852
853        # Construct URL
854        url = self.list_metric_definitions.metadata['url']  # type: ignore
855        path_format_arguments = {
856            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
857            'name': self._serialize.url("name", name, 'str'),
858            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
859        }
860        url = self._client.format_url(url, **path_format_arguments)
861
862        # Construct parameters
863        query_parameters = {}  # type: Dict[str, Any]
864        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
865
866        # Construct headers
867        header_parameters = {}  # type: Dict[str, Any]
868        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
869
870        request = self._client.get(url, query_parameters, header_parameters)
871        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
872        response = pipeline_response.http_response
873
874        if response.status_code not in [200]:
875            map_error(status_code=response.status_code, response=response, error_map=error_map)
876            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
877
878        deserialized = self._deserialize('MetricDefinition', pipeline_response)
879
880        if cls:
881            return cls(pipeline_response, deserialized, {})
882
883        return deserialized
884    list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions'}  # type: ignore
885
886    def list_metrics(
887        self,
888        resource_group_name: str,
889        name: str,
890        details: Optional[bool] = None,
891        filter: Optional[str] = None,
892        **kwargs: Any
893    ) -> AsyncIterable["_models.ResourceMetricCollection"]:
894        """Get global metrics of an App Service Environment.
895
896        Get global metrics of an App Service Environment.
897
898        :param resource_group_name: Name of the resource group to which the resource belongs.
899        :type resource_group_name: str
900        :param name: Name of the App Service Environment.
901        :type name: str
902        :param details: Specify :code:`<code>true</code>` to include instance details. The default is
903         :code:`<code>false</code>`.
904        :type details: bool
905        :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata
906         syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq
907         '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq
908         duration'[Hour|Minute|Day]'.
909        :type filter: str
910        :keyword callable cls: A custom type or function that will be passed the direct response
911        :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response)
912        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection]
913        :raises: ~azure.core.exceptions.HttpResponseError
914        """
915        cls = kwargs.pop('cls', None)  # type: ClsType["_models.ResourceMetricCollection"]
916        error_map = {
917            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
918        }
919        error_map.update(kwargs.pop('error_map', {}))
920        api_version = "2016-09-01"
921        accept = "application/json"
922
923        def prepare_request(next_link=None):
924            # Construct headers
925            header_parameters = {}  # type: Dict[str, Any]
926            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
927
928            if not next_link:
929                # Construct URL
930                url = self.list_metrics.metadata['url']  # type: ignore
931                path_format_arguments = {
932                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
933                    'name': self._serialize.url("name", name, 'str'),
934                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
935                }
936                url = self._client.format_url(url, **path_format_arguments)
937                # Construct parameters
938                query_parameters = {}  # type: Dict[str, Any]
939                if details is not None:
940                    query_parameters['details'] = self._serialize.query("details", details, 'bool')
941                if filter is not None:
942                    query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
943                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
944
945                request = self._client.get(url, query_parameters, header_parameters)
946            else:
947                url = next_link
948                query_parameters = {}  # type: Dict[str, Any]
949                request = self._client.get(url, query_parameters, header_parameters)
950            return request
951
952        async def extract_data(pipeline_response):
953            deserialized = self._deserialize('ResourceMetricCollection', pipeline_response)
954            list_of_elem = deserialized.value
955            if cls:
956                list_of_elem = cls(list_of_elem)
957            return deserialized.next_link or None, AsyncList(list_of_elem)
958
959        async def get_next(next_link=None):
960            request = prepare_request(next_link)
961
962            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
963            response = pipeline_response.http_response
964
965            if response.status_code not in [200]:
966                map_error(status_code=response.status_code, response=response, error_map=error_map)
967                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
968
969            return pipeline_response
970
971        return AsyncItemPaged(
972            get_next, extract_data
973        )
974    list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics'}  # type: ignore
975
976    def list_multi_role_pools(
977        self,
978        resource_group_name: str,
979        name: str,
980        **kwargs: Any
981    ) -> AsyncIterable["_models.WorkerPoolCollection"]:
982        """Get all multi-role pools.
983
984        Get all multi-role pools.
985
986        :param resource_group_name: Name of the resource group to which the resource belongs.
987        :type resource_group_name: str
988        :param name: Name of the App Service Environment.
989        :type name: str
990        :keyword callable cls: A custom type or function that will be passed the direct response
991        :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response)
992        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WorkerPoolCollection]
993        :raises: ~azure.core.exceptions.HttpResponseError
994        """
995        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WorkerPoolCollection"]
996        error_map = {
997            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
998        }
999        error_map.update(kwargs.pop('error_map', {}))
1000        api_version = "2016-09-01"
1001        accept = "application/json"
1002
1003        def prepare_request(next_link=None):
1004            # Construct headers
1005            header_parameters = {}  # type: Dict[str, Any]
1006            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1007
1008            if not next_link:
1009                # Construct URL
1010                url = self.list_multi_role_pools.metadata['url']  # type: ignore
1011                path_format_arguments = {
1012                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1013                    'name': self._serialize.url("name", name, 'str'),
1014                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1015                }
1016                url = self._client.format_url(url, **path_format_arguments)
1017                # Construct parameters
1018                query_parameters = {}  # type: Dict[str, Any]
1019                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1020
1021                request = self._client.get(url, query_parameters, header_parameters)
1022            else:
1023                url = next_link
1024                query_parameters = {}  # type: Dict[str, Any]
1025                request = self._client.get(url, query_parameters, header_parameters)
1026            return request
1027
1028        async def extract_data(pipeline_response):
1029            deserialized = self._deserialize('WorkerPoolCollection', pipeline_response)
1030            list_of_elem = deserialized.value
1031            if cls:
1032                list_of_elem = cls(list_of_elem)
1033            return deserialized.next_link or None, AsyncList(list_of_elem)
1034
1035        async def get_next(next_link=None):
1036            request = prepare_request(next_link)
1037
1038            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1039            response = pipeline_response.http_response
1040
1041            if response.status_code not in [200]:
1042                map_error(status_code=response.status_code, response=response, error_map=error_map)
1043                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1044
1045            return pipeline_response
1046
1047        return AsyncItemPaged(
1048            get_next, extract_data
1049        )
1050    list_multi_role_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools'}  # type: ignore
1051
1052    async def get_multi_role_pool(
1053        self,
1054        resource_group_name: str,
1055        name: str,
1056        **kwargs: Any
1057    ) -> "_models.WorkerPoolResource":
1058        """Get properties of a multi-role pool.
1059
1060        Get properties of a multi-role pool.
1061
1062        :param resource_group_name: Name of the resource group to which the resource belongs.
1063        :type resource_group_name: str
1064        :param name: Name of the App Service Environment.
1065        :type name: str
1066        :keyword callable cls: A custom type or function that will be passed the direct response
1067        :return: WorkerPoolResource, or the result of cls(response)
1068        :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource
1069        :raises: ~azure.core.exceptions.HttpResponseError
1070        """
1071        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WorkerPoolResource"]
1072        error_map = {
1073            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1074        }
1075        error_map.update(kwargs.pop('error_map', {}))
1076        api_version = "2016-09-01"
1077        accept = "application/json"
1078
1079        # Construct URL
1080        url = self.get_multi_role_pool.metadata['url']  # type: ignore
1081        path_format_arguments = {
1082            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1083            'name': self._serialize.url("name", name, 'str'),
1084            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1085        }
1086        url = self._client.format_url(url, **path_format_arguments)
1087
1088        # Construct parameters
1089        query_parameters = {}  # type: Dict[str, Any]
1090        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1091
1092        # Construct headers
1093        header_parameters = {}  # type: Dict[str, Any]
1094        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1095
1096        request = self._client.get(url, query_parameters, header_parameters)
1097        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1098        response = pipeline_response.http_response
1099
1100        if response.status_code not in [200]:
1101            map_error(status_code=response.status_code, response=response, error_map=error_map)
1102            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1103
1104        deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
1105
1106        if cls:
1107            return cls(pipeline_response, deserialized, {})
1108
1109        return deserialized
1110    get_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'}  # type: ignore
1111
1112    async def _create_or_update_multi_role_pool_initial(
1113        self,
1114        resource_group_name: str,
1115        name: str,
1116        multi_role_pool_envelope: "_models.WorkerPoolResource",
1117        **kwargs: Any
1118    ) -> Optional["_models.WorkerPoolResource"]:
1119        cls = kwargs.pop('cls', None)  # type: ClsType[Optional["_models.WorkerPoolResource"]]
1120        error_map = {
1121            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1122        }
1123        error_map.update(kwargs.pop('error_map', {}))
1124        api_version = "2016-09-01"
1125        content_type = kwargs.pop("content_type", "application/json")
1126        accept = "application/json"
1127
1128        # Construct URL
1129        url = self._create_or_update_multi_role_pool_initial.metadata['url']  # type: ignore
1130        path_format_arguments = {
1131            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1132            'name': self._serialize.url("name", name, 'str'),
1133            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1134        }
1135        url = self._client.format_url(url, **path_format_arguments)
1136
1137        # Construct parameters
1138        query_parameters = {}  # type: Dict[str, Any]
1139        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1140
1141        # Construct headers
1142        header_parameters = {}  # type: Dict[str, Any]
1143        header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
1144        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1145
1146        body_content_kwargs = {}  # type: Dict[str, Any]
1147        body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource')
1148        body_content_kwargs['content'] = body_content
1149        request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
1150        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1151        response = pipeline_response.http_response
1152
1153        if response.status_code not in [200, 202, 400, 404, 409]:
1154            map_error(status_code=response.status_code, response=response, error_map=error_map)
1155            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1156
1157        deserialized = None
1158        if response.status_code == 200:
1159            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
1160
1161        if response.status_code == 202:
1162            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
1163
1164        if cls:
1165            return cls(pipeline_response, deserialized, {})
1166
1167        return deserialized
1168    _create_or_update_multi_role_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'}  # type: ignore
1169
1170    async def begin_create_or_update_multi_role_pool(
1171        self,
1172        resource_group_name: str,
1173        name: str,
1174        multi_role_pool_envelope: "_models.WorkerPoolResource",
1175        **kwargs: Any
1176    ) -> AsyncLROPoller["_models.WorkerPoolResource"]:
1177        """Create or update a multi-role pool.
1178
1179        Create or update a multi-role pool.
1180
1181        :param resource_group_name: Name of the resource group to which the resource belongs.
1182        :type resource_group_name: str
1183        :param name: Name of the App Service Environment.
1184        :type name: str
1185        :param multi_role_pool_envelope: Properties of the multi-role pool.
1186        :type multi_role_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource
1187        :keyword callable cls: A custom type or function that will be passed the direct response
1188        :keyword str continuation_token: A continuation token to restart a poller from a saved state.
1189        :keyword polling: By default, your polling method will be AsyncARMPolling.
1190         Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
1191        :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
1192        :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
1193        :return: An instance of AsyncLROPoller that returns either WorkerPoolResource or the result of cls(response)
1194        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource]
1195        :raises ~azure.core.exceptions.HttpResponseError:
1196        """
1197        polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
1198        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WorkerPoolResource"]
1199        lro_delay = kwargs.pop(
1200            'polling_interval',
1201            self._config.polling_interval
1202        )
1203        cont_token = kwargs.pop('continuation_token', None)  # type: Optional[str]
1204        if cont_token is None:
1205            raw_result = await self._create_or_update_multi_role_pool_initial(
1206                resource_group_name=resource_group_name,
1207                name=name,
1208                multi_role_pool_envelope=multi_role_pool_envelope,
1209                cls=lambda x,y,z: x,
1210                **kwargs
1211            )
1212
1213        kwargs.pop('error_map', None)
1214        kwargs.pop('content_type', None)
1215
1216        def get_long_running_output(pipeline_response):
1217            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
1218
1219            if cls:
1220                return cls(pipeline_response, deserialized, {})
1221            return deserialized
1222
1223        path_format_arguments = {
1224            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1225            'name': self._serialize.url("name", name, 'str'),
1226            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1227        }
1228
1229        if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
1230        elif polling is False: polling_method = AsyncNoPolling()
1231        else: polling_method = polling
1232        if cont_token:
1233            return AsyncLROPoller.from_continuation_token(
1234                polling_method=polling_method,
1235                continuation_token=cont_token,
1236                client=self._client,
1237                deserialization_callback=get_long_running_output
1238            )
1239        else:
1240            return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
1241    begin_create_or_update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'}  # type: ignore
1242
1243    async def update_multi_role_pool(
1244        self,
1245        resource_group_name: str,
1246        name: str,
1247        multi_role_pool_envelope: "_models.WorkerPoolResource",
1248        **kwargs: Any
1249    ) -> Optional["_models.WorkerPoolResource"]:
1250        """Create or update a multi-role pool.
1251
1252        Create or update a multi-role pool.
1253
1254        :param resource_group_name: Name of the resource group to which the resource belongs.
1255        :type resource_group_name: str
1256        :param name: Name of the App Service Environment.
1257        :type name: str
1258        :param multi_role_pool_envelope: Properties of the multi-role pool.
1259        :type multi_role_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource
1260        :keyword callable cls: A custom type or function that will be passed the direct response
1261        :return: WorkerPoolResource, or the result of cls(response)
1262        :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or None
1263        :raises: ~azure.core.exceptions.HttpResponseError
1264        """
1265        cls = kwargs.pop('cls', None)  # type: ClsType[Optional["_models.WorkerPoolResource"]]
1266        error_map = {
1267            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1268        }
1269        error_map.update(kwargs.pop('error_map', {}))
1270        api_version = "2016-09-01"
1271        content_type = kwargs.pop("content_type", "application/json")
1272        accept = "application/json"
1273
1274        # Construct URL
1275        url = self.update_multi_role_pool.metadata['url']  # type: ignore
1276        path_format_arguments = {
1277            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1278            'name': self._serialize.url("name", name, 'str'),
1279            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1280        }
1281        url = self._client.format_url(url, **path_format_arguments)
1282
1283        # Construct parameters
1284        query_parameters = {}  # type: Dict[str, Any]
1285        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1286
1287        # Construct headers
1288        header_parameters = {}  # type: Dict[str, Any]
1289        header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
1290        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1291
1292        body_content_kwargs = {}  # type: Dict[str, Any]
1293        body_content = self._serialize.body(multi_role_pool_envelope, 'WorkerPoolResource')
1294        body_content_kwargs['content'] = body_content
1295        request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)
1296        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1297        response = pipeline_response.http_response
1298
1299        if response.status_code not in [200, 202, 400, 404, 409]:
1300            map_error(status_code=response.status_code, response=response, error_map=error_map)
1301            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1302
1303        deserialized = None
1304        if response.status_code == 200:
1305            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
1306
1307        if response.status_code == 202:
1308            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
1309
1310        if cls:
1311            return cls(pipeline_response, deserialized, {})
1312
1313        return deserialized
1314    update_multi_role_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default'}  # type: ignore
1315
1316    def list_multi_role_pool_instance_metric_definitions(
1317        self,
1318        resource_group_name: str,
1319        name: str,
1320        instance: str,
1321        **kwargs: Any
1322    ) -> AsyncIterable["_models.ResourceMetricDefinitionCollection"]:
1323        """Get metric definitions for a specific instance of a multi-role pool of an App Service Environment.
1324
1325        Get metric definitions for a specific instance of a multi-role pool of an App Service
1326        Environment.
1327
1328        :param resource_group_name: Name of the resource group to which the resource belongs.
1329        :type resource_group_name: str
1330        :param name: Name of the App Service Environment.
1331        :type name: str
1332        :param instance: Name of the instance in the multi-role pool.
1333        :type instance: str
1334        :keyword callable cls: A custom type or function that will be passed the direct response
1335        :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response)
1336        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection]
1337        :raises: ~azure.core.exceptions.HttpResponseError
1338        """
1339        cls = kwargs.pop('cls', None)  # type: ClsType["_models.ResourceMetricDefinitionCollection"]
1340        error_map = {
1341            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1342        }
1343        error_map.update(kwargs.pop('error_map', {}))
1344        api_version = "2016-09-01"
1345        accept = "application/json"
1346
1347        def prepare_request(next_link=None):
1348            # Construct headers
1349            header_parameters = {}  # type: Dict[str, Any]
1350            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1351
1352            if not next_link:
1353                # Construct URL
1354                url = self.list_multi_role_pool_instance_metric_definitions.metadata['url']  # type: ignore
1355                path_format_arguments = {
1356                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1357                    'name': self._serialize.url("name", name, 'str'),
1358                    'instance': self._serialize.url("instance", instance, 'str'),
1359                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1360                }
1361                url = self._client.format_url(url, **path_format_arguments)
1362                # Construct parameters
1363                query_parameters = {}  # type: Dict[str, Any]
1364                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1365
1366                request = self._client.get(url, query_parameters, header_parameters)
1367            else:
1368                url = next_link
1369                query_parameters = {}  # type: Dict[str, Any]
1370                request = self._client.get(url, query_parameters, header_parameters)
1371            return request
1372
1373        async def extract_data(pipeline_response):
1374            deserialized = self._deserialize('ResourceMetricDefinitionCollection', pipeline_response)
1375            list_of_elem = deserialized.value
1376            if cls:
1377                list_of_elem = cls(list_of_elem)
1378            return deserialized.next_link or None, AsyncList(list_of_elem)
1379
1380        async def get_next(next_link=None):
1381            request = prepare_request(next_link)
1382
1383            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1384            response = pipeline_response.http_response
1385
1386            if response.status_code not in [200]:
1387                map_error(status_code=response.status_code, response=response, error_map=error_map)
1388                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1389
1390            return pipeline_response
1391
1392        return AsyncItemPaged(
1393            get_next, extract_data
1394        )
1395    list_multi_role_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions'}  # type: ignore
1396
1397    def list_multi_role_pool_instance_metrics(
1398        self,
1399        resource_group_name: str,
1400        name: str,
1401        instance: str,
1402        details: Optional[bool] = None,
1403        **kwargs: Any
1404    ) -> AsyncIterable["_models.ResourceMetricCollection"]:
1405        """Get metrics for a specific instance of a multi-role pool of an App Service Environment.
1406
1407        Get metrics for a specific instance of a multi-role pool of an App Service Environment.
1408
1409        :param resource_group_name: Name of the resource group to which the resource belongs.
1410        :type resource_group_name: str
1411        :param name: Name of the App Service Environment.
1412        :type name: str
1413        :param instance: Name of the instance in the multi-role pool.
1414        :type instance: str
1415        :param details: Specify :code:`<code>true</code>` to include instance details. The default is
1416         :code:`<code>false</code>`.
1417        :type details: bool
1418        :keyword callable cls: A custom type or function that will be passed the direct response
1419        :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response)
1420        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection]
1421        :raises: ~azure.core.exceptions.HttpResponseError
1422        """
1423        cls = kwargs.pop('cls', None)  # type: ClsType["_models.ResourceMetricCollection"]
1424        error_map = {
1425            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1426        }
1427        error_map.update(kwargs.pop('error_map', {}))
1428        api_version = "2016-09-01"
1429        accept = "application/json"
1430
1431        def prepare_request(next_link=None):
1432            # Construct headers
1433            header_parameters = {}  # type: Dict[str, Any]
1434            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1435
1436            if not next_link:
1437                # Construct URL
1438                url = self.list_multi_role_pool_instance_metrics.metadata['url']  # type: ignore
1439                path_format_arguments = {
1440                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1441                    'name': self._serialize.url("name", name, 'str'),
1442                    'instance': self._serialize.url("instance", instance, 'str'),
1443                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1444                }
1445                url = self._client.format_url(url, **path_format_arguments)
1446                # Construct parameters
1447                query_parameters = {}  # type: Dict[str, Any]
1448                if details is not None:
1449                    query_parameters['details'] = self._serialize.query("details", details, 'bool')
1450                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1451
1452                request = self._client.get(url, query_parameters, header_parameters)
1453            else:
1454                url = next_link
1455                query_parameters = {}  # type: Dict[str, Any]
1456                request = self._client.get(url, query_parameters, header_parameters)
1457            return request
1458
1459        async def extract_data(pipeline_response):
1460            deserialized = self._deserialize('ResourceMetricCollection', pipeline_response)
1461            list_of_elem = deserialized.value
1462            if cls:
1463                list_of_elem = cls(list_of_elem)
1464            return deserialized.next_link or None, AsyncList(list_of_elem)
1465
1466        async def get_next(next_link=None):
1467            request = prepare_request(next_link)
1468
1469            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1470            response = pipeline_response.http_response
1471
1472            if response.status_code not in [200]:
1473                map_error(status_code=response.status_code, response=response, error_map=error_map)
1474                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1475
1476            return pipeline_response
1477
1478        return AsyncItemPaged(
1479            get_next, extract_data
1480        )
1481    list_multi_role_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metrics'}  # type: ignore
1482
1483    def list_multi_role_metric_definitions(
1484        self,
1485        resource_group_name: str,
1486        name: str,
1487        **kwargs: Any
1488    ) -> AsyncIterable["_models.ResourceMetricDefinitionCollection"]:
1489        """Get metric definitions for a multi-role pool of an App Service Environment.
1490
1491        Get metric definitions for a multi-role pool of an App Service Environment.
1492
1493        :param resource_group_name: Name of the resource group to which the resource belongs.
1494        :type resource_group_name: str
1495        :param name: Name of the App Service Environment.
1496        :type name: str
1497        :keyword callable cls: A custom type or function that will be passed the direct response
1498        :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response)
1499        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection]
1500        :raises: ~azure.core.exceptions.HttpResponseError
1501        """
1502        cls = kwargs.pop('cls', None)  # type: ClsType["_models.ResourceMetricDefinitionCollection"]
1503        error_map = {
1504            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1505        }
1506        error_map.update(kwargs.pop('error_map', {}))
1507        api_version = "2016-09-01"
1508        accept = "application/json"
1509
1510        def prepare_request(next_link=None):
1511            # Construct headers
1512            header_parameters = {}  # type: Dict[str, Any]
1513            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1514
1515            if not next_link:
1516                # Construct URL
1517                url = self.list_multi_role_metric_definitions.metadata['url']  # type: ignore
1518                path_format_arguments = {
1519                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1520                    'name': self._serialize.url("name", name, 'str'),
1521                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1522                }
1523                url = self._client.format_url(url, **path_format_arguments)
1524                # Construct parameters
1525                query_parameters = {}  # type: Dict[str, Any]
1526                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1527
1528                request = self._client.get(url, query_parameters, header_parameters)
1529            else:
1530                url = next_link
1531                query_parameters = {}  # type: Dict[str, Any]
1532                request = self._client.get(url, query_parameters, header_parameters)
1533            return request
1534
1535        async def extract_data(pipeline_response):
1536            deserialized = self._deserialize('ResourceMetricDefinitionCollection', pipeline_response)
1537            list_of_elem = deserialized.value
1538            if cls:
1539                list_of_elem = cls(list_of_elem)
1540            return deserialized.next_link or None, AsyncList(list_of_elem)
1541
1542        async def get_next(next_link=None):
1543            request = prepare_request(next_link)
1544
1545            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1546            response = pipeline_response.http_response
1547
1548            if response.status_code not in [200]:
1549                map_error(status_code=response.status_code, response=response, error_map=error_map)
1550                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1551
1552            return pipeline_response
1553
1554        return AsyncItemPaged(
1555            get_next, extract_data
1556        )
1557    list_multi_role_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions'}  # type: ignore
1558
1559    def list_multi_role_metrics(
1560        self,
1561        resource_group_name: str,
1562        name: str,
1563        start_time: Optional[str] = None,
1564        end_time: Optional[str] = None,
1565        time_grain: Optional[str] = None,
1566        details: Optional[bool] = None,
1567        filter: Optional[str] = None,
1568        **kwargs: Any
1569    ) -> AsyncIterable["_models.ResourceMetricCollection"]:
1570        """Get metrics for a multi-role pool of an App Service Environment.
1571
1572        Get metrics for a multi-role pool of an App Service Environment.
1573
1574        :param resource_group_name: Name of the resource group to which the resource belongs.
1575        :type resource_group_name: str
1576        :param name: Name of the App Service Environment.
1577        :type name: str
1578        :param start_time: Beginning time of the metrics query.
1579        :type start_time: str
1580        :param end_time: End time of the metrics query.
1581        :type end_time: str
1582        :param time_grain: Time granularity of the metrics query.
1583        :type time_grain: str
1584        :param details: Specify :code:`<code>true</code>` to include instance details. The default is
1585         :code:`<code>false</code>`.
1586        :type details: bool
1587        :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata
1588         syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq
1589         '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq
1590         duration'[Hour|Minute|Day]'.
1591        :type filter: str
1592        :keyword callable cls: A custom type or function that will be passed the direct response
1593        :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response)
1594        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection]
1595        :raises: ~azure.core.exceptions.HttpResponseError
1596        """
1597        cls = kwargs.pop('cls', None)  # type: ClsType["_models.ResourceMetricCollection"]
1598        error_map = {
1599            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1600        }
1601        error_map.update(kwargs.pop('error_map', {}))
1602        api_version = "2016-09-01"
1603        accept = "application/json"
1604
1605        def prepare_request(next_link=None):
1606            # Construct headers
1607            header_parameters = {}  # type: Dict[str, Any]
1608            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1609
1610            if not next_link:
1611                # Construct URL
1612                url = self.list_multi_role_metrics.metadata['url']  # type: ignore
1613                path_format_arguments = {
1614                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1615                    'name': self._serialize.url("name", name, 'str'),
1616                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1617                }
1618                url = self._client.format_url(url, **path_format_arguments)
1619                # Construct parameters
1620                query_parameters = {}  # type: Dict[str, Any]
1621                if start_time is not None:
1622                    query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str')
1623                if end_time is not None:
1624                    query_parameters['endTime'] = self._serialize.query("end_time", end_time, 'str')
1625                if time_grain is not None:
1626                    query_parameters['timeGrain'] = self._serialize.query("time_grain", time_grain, 'str')
1627                if details is not None:
1628                    query_parameters['details'] = self._serialize.query("details", details, 'bool')
1629                if filter is not None:
1630                    query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
1631                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1632
1633                request = self._client.get(url, query_parameters, header_parameters)
1634            else:
1635                url = next_link
1636                query_parameters = {}  # type: Dict[str, Any]
1637                request = self._client.get(url, query_parameters, header_parameters)
1638            return request
1639
1640        async def extract_data(pipeline_response):
1641            deserialized = self._deserialize('ResourceMetricCollection', pipeline_response)
1642            list_of_elem = deserialized.value
1643            if cls:
1644                list_of_elem = cls(list_of_elem)
1645            return deserialized.next_link or None, AsyncList(list_of_elem)
1646
1647        async def get_next(next_link=None):
1648            request = prepare_request(next_link)
1649
1650            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1651            response = pipeline_response.http_response
1652
1653            if response.status_code not in [200]:
1654                map_error(status_code=response.status_code, response=response, error_map=error_map)
1655                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1656
1657            return pipeline_response
1658
1659        return AsyncItemPaged(
1660            get_next, extract_data
1661        )
1662    list_multi_role_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics'}  # type: ignore
1663
1664    def list_multi_role_pool_skus(
1665        self,
1666        resource_group_name: str,
1667        name: str,
1668        **kwargs: Any
1669    ) -> AsyncIterable["_models.SkuInfoCollection"]:
1670        """Get available SKUs for scaling a multi-role pool.
1671
1672        Get available SKUs for scaling a multi-role pool.
1673
1674        :param resource_group_name: Name of the resource group to which the resource belongs.
1675        :type resource_group_name: str
1676        :param name: Name of the App Service Environment.
1677        :type name: str
1678        :keyword callable cls: A custom type or function that will be passed the direct response
1679        :return: An iterator like instance of either SkuInfoCollection or the result of cls(response)
1680        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.SkuInfoCollection]
1681        :raises: ~azure.core.exceptions.HttpResponseError
1682        """
1683        cls = kwargs.pop('cls', None)  # type: ClsType["_models.SkuInfoCollection"]
1684        error_map = {
1685            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1686        }
1687        error_map.update(kwargs.pop('error_map', {}))
1688        api_version = "2016-09-01"
1689        accept = "application/json"
1690
1691        def prepare_request(next_link=None):
1692            # Construct headers
1693            header_parameters = {}  # type: Dict[str, Any]
1694            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1695
1696            if not next_link:
1697                # Construct URL
1698                url = self.list_multi_role_pool_skus.metadata['url']  # type: ignore
1699                path_format_arguments = {
1700                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1701                    'name': self._serialize.url("name", name, 'str'),
1702                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1703                }
1704                url = self._client.format_url(url, **path_format_arguments)
1705                # Construct parameters
1706                query_parameters = {}  # type: Dict[str, Any]
1707                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1708
1709                request = self._client.get(url, query_parameters, header_parameters)
1710            else:
1711                url = next_link
1712                query_parameters = {}  # type: Dict[str, Any]
1713                request = self._client.get(url, query_parameters, header_parameters)
1714            return request
1715
1716        async def extract_data(pipeline_response):
1717            deserialized = self._deserialize('SkuInfoCollection', pipeline_response)
1718            list_of_elem = deserialized.value
1719            if cls:
1720                list_of_elem = cls(list_of_elem)
1721            return deserialized.next_link or None, AsyncList(list_of_elem)
1722
1723        async def get_next(next_link=None):
1724            request = prepare_request(next_link)
1725
1726            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1727            response = pipeline_response.http_response
1728
1729            if response.status_code not in [200]:
1730                map_error(status_code=response.status_code, response=response, error_map=error_map)
1731                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1732
1733            return pipeline_response
1734
1735        return AsyncItemPaged(
1736            get_next, extract_data
1737        )
1738    list_multi_role_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus'}  # type: ignore
1739
1740    def list_multi_role_usages(
1741        self,
1742        resource_group_name: str,
1743        name: str,
1744        **kwargs: Any
1745    ) -> AsyncIterable["_models.UsageCollection"]:
1746        """Get usage metrics for a multi-role pool of an App Service Environment.
1747
1748        Get usage metrics for a multi-role pool of an App Service Environment.
1749
1750        :param resource_group_name: Name of the resource group to which the resource belongs.
1751        :type resource_group_name: str
1752        :param name: Name of the App Service Environment.
1753        :type name: str
1754        :keyword callable cls: A custom type or function that will be passed the direct response
1755        :return: An iterator like instance of either UsageCollection or the result of cls(response)
1756        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.UsageCollection]
1757        :raises: ~azure.core.exceptions.HttpResponseError
1758        """
1759        cls = kwargs.pop('cls', None)  # type: ClsType["_models.UsageCollection"]
1760        error_map = {
1761            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1762        }
1763        error_map.update(kwargs.pop('error_map', {}))
1764        api_version = "2016-09-01"
1765        accept = "application/json"
1766
1767        def prepare_request(next_link=None):
1768            # Construct headers
1769            header_parameters = {}  # type: Dict[str, Any]
1770            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1771
1772            if not next_link:
1773                # Construct URL
1774                url = self.list_multi_role_usages.metadata['url']  # type: ignore
1775                path_format_arguments = {
1776                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1777                    'name': self._serialize.url("name", name, 'str'),
1778                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1779                }
1780                url = self._client.format_url(url, **path_format_arguments)
1781                # Construct parameters
1782                query_parameters = {}  # type: Dict[str, Any]
1783                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1784
1785                request = self._client.get(url, query_parameters, header_parameters)
1786            else:
1787                url = next_link
1788                query_parameters = {}  # type: Dict[str, Any]
1789                request = self._client.get(url, query_parameters, header_parameters)
1790            return request
1791
1792        async def extract_data(pipeline_response):
1793            deserialized = self._deserialize('UsageCollection', pipeline_response)
1794            list_of_elem = deserialized.value
1795            if cls:
1796                list_of_elem = cls(list_of_elem)
1797            return deserialized.next_link or None, AsyncList(list_of_elem)
1798
1799        async def get_next(next_link=None):
1800            request = prepare_request(next_link)
1801
1802            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1803            response = pipeline_response.http_response
1804
1805            if response.status_code not in [200]:
1806                map_error(status_code=response.status_code, response=response, error_map=error_map)
1807                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1808
1809            return pipeline_response
1810
1811        return AsyncItemPaged(
1812            get_next, extract_data
1813        )
1814    list_multi_role_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages'}  # type: ignore
1815
1816    async def list_operations(
1817        self,
1818        resource_group_name: str,
1819        name: str,
1820        **kwargs: Any
1821    ) -> List["_models.Operation"]:
1822        """List all currently running operations on the App Service Environment.
1823
1824        List all currently running operations on the App Service Environment.
1825
1826        :param resource_group_name: Name of the resource group to which the resource belongs.
1827        :type resource_group_name: str
1828        :param name: Name of the App Service Environment.
1829        :type name: str
1830        :keyword callable cls: A custom type or function that will be passed the direct response
1831        :return: list of Operation, or the result of cls(response)
1832        :rtype: list[~azure.mgmt.web.v2016_09_01.models.Operation]
1833        :raises: ~azure.core.exceptions.HttpResponseError
1834        """
1835        cls = kwargs.pop('cls', None)  # type: ClsType[List["_models.Operation"]]
1836        error_map = {
1837            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1838        }
1839        error_map.update(kwargs.pop('error_map', {}))
1840        api_version = "2016-09-01"
1841        accept = "application/json"
1842
1843        # Construct URL
1844        url = self.list_operations.metadata['url']  # type: ignore
1845        path_format_arguments = {
1846            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1847            'name': self._serialize.url("name", name, 'str'),
1848            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1849        }
1850        url = self._client.format_url(url, **path_format_arguments)
1851
1852        # Construct parameters
1853        query_parameters = {}  # type: Dict[str, Any]
1854        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1855
1856        # Construct headers
1857        header_parameters = {}  # type: Dict[str, Any]
1858        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1859
1860        request = self._client.get(url, query_parameters, header_parameters)
1861        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1862        response = pipeline_response.http_response
1863
1864        if response.status_code not in [200]:
1865            map_error(status_code=response.status_code, response=response, error_map=error_map)
1866            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1867
1868        deserialized = self._deserialize('[Operation]', pipeline_response)
1869
1870        if cls:
1871            return cls(pipeline_response, deserialized, {})
1872
1873        return deserialized
1874    list_operations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations'}  # type: ignore
1875
1876    async def reboot(
1877        self,
1878        resource_group_name: str,
1879        name: str,
1880        **kwargs: Any
1881    ) -> None:
1882        """Reboot all machines in an App Service Environment.
1883
1884        Reboot all machines in an App Service Environment.
1885
1886        :param resource_group_name: Name of the resource group to which the resource belongs.
1887        :type resource_group_name: str
1888        :param name: Name of the App Service Environment.
1889        :type name: str
1890        :keyword callable cls: A custom type or function that will be passed the direct response
1891        :return: None, or the result of cls(response)
1892        :rtype: None
1893        :raises: ~azure.core.exceptions.HttpResponseError
1894        """
1895        cls = kwargs.pop('cls', None)  # type: ClsType[None]
1896        error_map = {
1897            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1898        }
1899        error_map.update(kwargs.pop('error_map', {}))
1900        api_version = "2016-09-01"
1901
1902        # Construct URL
1903        url = self.reboot.metadata['url']  # type: ignore
1904        path_format_arguments = {
1905            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1906            'name': self._serialize.url("name", name, 'str'),
1907            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1908        }
1909        url = self._client.format_url(url, **path_format_arguments)
1910
1911        # Construct parameters
1912        query_parameters = {}  # type: Dict[str, Any]
1913        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1914
1915        # Construct headers
1916        header_parameters = {}  # type: Dict[str, Any]
1917
1918        request = self._client.post(url, query_parameters, header_parameters)
1919        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1920        response = pipeline_response.http_response
1921
1922        if response.status_code not in [202, 400, 404, 409]:
1923            map_error(status_code=response.status_code, response=response, error_map=error_map)
1924            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1925
1926        if cls:
1927            return cls(pipeline_response, None, {})
1928
1929    reboot.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'}  # type: ignore
1930
1931    async def _resume_initial(
1932        self,
1933        resource_group_name: str,
1934        name: str,
1935        **kwargs: Any
1936    ) -> "_models.WebAppCollection":
1937        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WebAppCollection"]
1938        error_map = {
1939            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
1940        }
1941        error_map.update(kwargs.pop('error_map', {}))
1942        api_version = "2016-09-01"
1943        accept = "application/json"
1944
1945        # Construct URL
1946        url = self._resume_initial.metadata['url']  # type: ignore
1947        path_format_arguments = {
1948            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
1949            'name': self._serialize.url("name", name, 'str'),
1950            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
1951        }
1952        url = self._client.format_url(url, **path_format_arguments)
1953
1954        # Construct parameters
1955        query_parameters = {}  # type: Dict[str, Any]
1956        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
1957
1958        # Construct headers
1959        header_parameters = {}  # type: Dict[str, Any]
1960        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
1961
1962        request = self._client.post(url, query_parameters, header_parameters)
1963        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
1964        response = pipeline_response.http_response
1965
1966        if response.status_code not in [200, 202]:
1967            map_error(status_code=response.status_code, response=response, error_map=error_map)
1968            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
1969
1970        if response.status_code == 200:
1971            deserialized = self._deserialize('WebAppCollection', pipeline_response)
1972
1973        if response.status_code == 202:
1974            deserialized = self._deserialize('WebAppCollection', pipeline_response)
1975
1976        if cls:
1977            return cls(pipeline_response, deserialized, {})
1978
1979        return deserialized
1980    _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'}  # type: ignore
1981
1982    async def begin_resume(
1983        self,
1984        resource_group_name: str,
1985        name: str,
1986        **kwargs: Any
1987    ) -> AsyncLROPoller[AsyncItemPaged["_models.WebAppCollection"]]:
1988        """Resume an App Service Environment.
1989
1990        Resume an App Service Environment.
1991
1992        :param resource_group_name: Name of the resource group to which the resource belongs.
1993        :type resource_group_name: str
1994        :param name: Name of the App Service Environment.
1995        :type name: str
1996        :keyword callable cls: A custom type or function that will be passed the direct response
1997        :keyword str continuation_token: A continuation token to restart a poller from a saved state.
1998        :keyword polling: By default, your polling method will be AsyncARMPolling.
1999         Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
2000        :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
2001        :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
2002        :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response)
2003        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection]]
2004        :raises ~azure.core.exceptions.HttpResponseError:
2005        """
2006        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WebAppCollection"]
2007        error_map = {
2008            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2009        }
2010        error_map.update(kwargs.pop('error_map', {}))
2011        api_version = "2016-09-01"
2012        accept = "application/json"
2013
2014        def prepare_request(next_link=None):
2015            # Construct headers
2016            header_parameters = {}  # type: Dict[str, Any]
2017            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2018
2019            if not next_link:
2020                # Construct URL
2021                url = self.resume.metadata['url']  # type: ignore
2022                path_format_arguments = {
2023                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2024                    'name': self._serialize.url("name", name, 'str'),
2025                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2026                }
2027                url = self._client.format_url(url, **path_format_arguments)
2028                # Construct parameters
2029                query_parameters = {}  # type: Dict[str, Any]
2030                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2031
2032                request = self._client.post(url, query_parameters, header_parameters)
2033            else:
2034                url = next_link
2035                query_parameters = {}  # type: Dict[str, Any]
2036                request = self._client.get(url, query_parameters, header_parameters)
2037            return request
2038
2039        async def extract_data(pipeline_response):
2040            deserialized = self._deserialize('WebAppCollection', pipeline_response)
2041            list_of_elem = deserialized.value
2042            if cls:
2043                list_of_elem = cls(list_of_elem)
2044            return deserialized.next_link or None, AsyncList(list_of_elem)
2045
2046        async def get_next(next_link=None):
2047            request = prepare_request(next_link)
2048
2049            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2050            response = pipeline_response.http_response
2051
2052            if response.status_code not in [200]:
2053                map_error(status_code=response.status_code, response=response, error_map=error_map)
2054                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2055
2056            return pipeline_response
2057
2058        polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
2059        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WebAppCollection"]
2060        lro_delay = kwargs.pop(
2061            'polling_interval',
2062            self._config.polling_interval
2063        )
2064        cont_token = kwargs.pop('continuation_token', None)  # type: Optional[str]
2065        if cont_token is None:
2066            raw_result = await self._resume_initial(
2067                resource_group_name=resource_group_name,
2068                name=name,
2069                cls=lambda x,y,z: x,
2070                **kwargs
2071            )
2072
2073        kwargs.pop('error_map', None)
2074        kwargs.pop('content_type', None)
2075        def get_long_running_output(pipeline_response):
2076            async def internal_get_next(next_link=None):
2077                if next_link is None:
2078                    return pipeline_response
2079                else:
2080                    return await get_next(next_link)
2081
2082            return AsyncItemPaged(
2083                internal_get_next, extract_data
2084            )
2085        path_format_arguments = {
2086            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2087            'name': self._serialize.url("name", name, 'str'),
2088            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2089        }
2090
2091        if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
2092        elif polling is False: polling_method = AsyncNoPolling()
2093        else: polling_method = polling
2094        if cont_token:
2095            return AsyncLROPoller.from_continuation_token(
2096                polling_method=polling_method,
2097                continuation_token=cont_token,
2098                client=self._client,
2099                deserialization_callback=get_long_running_output
2100            )
2101        else:
2102            return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
2103    begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume'}  # type: ignore
2104
2105    def list_app_service_plans(
2106        self,
2107        resource_group_name: str,
2108        name: str,
2109        **kwargs: Any
2110    ) -> AsyncIterable["_models.AppServicePlanCollection"]:
2111        """Get all App Service plans in an App Service Environment.
2112
2113        Get all App Service plans in an App Service Environment.
2114
2115        :param resource_group_name: Name of the resource group to which the resource belongs.
2116        :type resource_group_name: str
2117        :param name: Name of the App Service Environment.
2118        :type name: str
2119        :keyword callable cls: A custom type or function that will be passed the direct response
2120        :return: An iterator like instance of either AppServicePlanCollection or the result of cls(response)
2121        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.AppServicePlanCollection]
2122        :raises: ~azure.core.exceptions.HttpResponseError
2123        """
2124        cls = kwargs.pop('cls', None)  # type: ClsType["_models.AppServicePlanCollection"]
2125        error_map = {
2126            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2127        }
2128        error_map.update(kwargs.pop('error_map', {}))
2129        api_version = "2016-09-01"
2130        accept = "application/json"
2131
2132        def prepare_request(next_link=None):
2133            # Construct headers
2134            header_parameters = {}  # type: Dict[str, Any]
2135            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2136
2137            if not next_link:
2138                # Construct URL
2139                url = self.list_app_service_plans.metadata['url']  # type: ignore
2140                path_format_arguments = {
2141                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2142                    'name': self._serialize.url("name", name, 'str'),
2143                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2144                }
2145                url = self._client.format_url(url, **path_format_arguments)
2146                # Construct parameters
2147                query_parameters = {}  # type: Dict[str, Any]
2148                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2149
2150                request = self._client.get(url, query_parameters, header_parameters)
2151            else:
2152                url = next_link
2153                query_parameters = {}  # type: Dict[str, Any]
2154                request = self._client.get(url, query_parameters, header_parameters)
2155            return request
2156
2157        async def extract_data(pipeline_response):
2158            deserialized = self._deserialize('AppServicePlanCollection', pipeline_response)
2159            list_of_elem = deserialized.value
2160            if cls:
2161                list_of_elem = cls(list_of_elem)
2162            return deserialized.next_link or None, AsyncList(list_of_elem)
2163
2164        async def get_next(next_link=None):
2165            request = prepare_request(next_link)
2166
2167            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2168            response = pipeline_response.http_response
2169
2170            if response.status_code not in [200]:
2171                map_error(status_code=response.status_code, response=response, error_map=error_map)
2172                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2173
2174            return pipeline_response
2175
2176        return AsyncItemPaged(
2177            get_next, extract_data
2178        )
2179    list_app_service_plans.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms'}  # type: ignore
2180
2181    def list_web_apps(
2182        self,
2183        resource_group_name: str,
2184        name: str,
2185        properties_to_include: Optional[str] = None,
2186        **kwargs: Any
2187    ) -> AsyncIterable["_models.WebAppCollection"]:
2188        """Get all apps in an App Service Environment.
2189
2190        Get all apps in an App Service Environment.
2191
2192        :param resource_group_name: Name of the resource group to which the resource belongs.
2193        :type resource_group_name: str
2194        :param name: Name of the App Service Environment.
2195        :type name: str
2196        :param properties_to_include: Comma separated list of app properties to include.
2197        :type properties_to_include: str
2198        :keyword callable cls: A custom type or function that will be passed the direct response
2199        :return: An iterator like instance of either WebAppCollection or the result of cls(response)
2200        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection]
2201        :raises: ~azure.core.exceptions.HttpResponseError
2202        """
2203        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WebAppCollection"]
2204        error_map = {
2205            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2206        }
2207        error_map.update(kwargs.pop('error_map', {}))
2208        api_version = "2016-09-01"
2209        accept = "application/json"
2210
2211        def prepare_request(next_link=None):
2212            # Construct headers
2213            header_parameters = {}  # type: Dict[str, Any]
2214            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2215
2216            if not next_link:
2217                # Construct URL
2218                url = self.list_web_apps.metadata['url']  # type: ignore
2219                path_format_arguments = {
2220                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2221                    'name': self._serialize.url("name", name, 'str'),
2222                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2223                }
2224                url = self._client.format_url(url, **path_format_arguments)
2225                # Construct parameters
2226                query_parameters = {}  # type: Dict[str, Any]
2227                if properties_to_include is not None:
2228                    query_parameters['propertiesToInclude'] = self._serialize.query("properties_to_include", properties_to_include, 'str')
2229                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2230
2231                request = self._client.get(url, query_parameters, header_parameters)
2232            else:
2233                url = next_link
2234                query_parameters = {}  # type: Dict[str, Any]
2235                request = self._client.get(url, query_parameters, header_parameters)
2236            return request
2237
2238        async def extract_data(pipeline_response):
2239            deserialized = self._deserialize('WebAppCollection', pipeline_response)
2240            list_of_elem = deserialized.value
2241            if cls:
2242                list_of_elem = cls(list_of_elem)
2243            return deserialized.next_link or None, AsyncList(list_of_elem)
2244
2245        async def get_next(next_link=None):
2246            request = prepare_request(next_link)
2247
2248            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2249            response = pipeline_response.http_response
2250
2251            if response.status_code not in [200]:
2252                map_error(status_code=response.status_code, response=response, error_map=error_map)
2253                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2254
2255            return pipeline_response
2256
2257        return AsyncItemPaged(
2258            get_next, extract_data
2259        )
2260    list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites'}  # type: ignore
2261
2262    async def _suspend_initial(
2263        self,
2264        resource_group_name: str,
2265        name: str,
2266        **kwargs: Any
2267    ) -> "_models.WebAppCollection":
2268        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WebAppCollection"]
2269        error_map = {
2270            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2271        }
2272        error_map.update(kwargs.pop('error_map', {}))
2273        api_version = "2016-09-01"
2274        accept = "application/json"
2275
2276        # Construct URL
2277        url = self._suspend_initial.metadata['url']  # type: ignore
2278        path_format_arguments = {
2279            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2280            'name': self._serialize.url("name", name, 'str'),
2281            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2282        }
2283        url = self._client.format_url(url, **path_format_arguments)
2284
2285        # Construct parameters
2286        query_parameters = {}  # type: Dict[str, Any]
2287        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2288
2289        # Construct headers
2290        header_parameters = {}  # type: Dict[str, Any]
2291        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2292
2293        request = self._client.post(url, query_parameters, header_parameters)
2294        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2295        response = pipeline_response.http_response
2296
2297        if response.status_code not in [200, 202]:
2298            map_error(status_code=response.status_code, response=response, error_map=error_map)
2299            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2300
2301        if response.status_code == 200:
2302            deserialized = self._deserialize('WebAppCollection', pipeline_response)
2303
2304        if response.status_code == 202:
2305            deserialized = self._deserialize('WebAppCollection', pipeline_response)
2306
2307        if cls:
2308            return cls(pipeline_response, deserialized, {})
2309
2310        return deserialized
2311    _suspend_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'}  # type: ignore
2312
2313    async def begin_suspend(
2314        self,
2315        resource_group_name: str,
2316        name: str,
2317        **kwargs: Any
2318    ) -> AsyncLROPoller[AsyncItemPaged["_models.WebAppCollection"]]:
2319        """Suspend an App Service Environment.
2320
2321        Suspend an App Service Environment.
2322
2323        :param resource_group_name: Name of the resource group to which the resource belongs.
2324        :type resource_group_name: str
2325        :param name: Name of the App Service Environment.
2326        :type name: str
2327        :keyword callable cls: A custom type or function that will be passed the direct response
2328        :keyword str continuation_token: A continuation token to restart a poller from a saved state.
2329        :keyword polling: By default, your polling method will be AsyncARMPolling.
2330         Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
2331        :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
2332        :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
2333        :return: An instance of AsyncLROPoller that returns an iterator like instance of either WebAppCollection or the result of cls(response)
2334        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WebAppCollection]]
2335        :raises ~azure.core.exceptions.HttpResponseError:
2336        """
2337        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WebAppCollection"]
2338        error_map = {
2339            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2340        }
2341        error_map.update(kwargs.pop('error_map', {}))
2342        api_version = "2016-09-01"
2343        accept = "application/json"
2344
2345        def prepare_request(next_link=None):
2346            # Construct headers
2347            header_parameters = {}  # type: Dict[str, Any]
2348            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2349
2350            if not next_link:
2351                # Construct URL
2352                url = self.suspend.metadata['url']  # type: ignore
2353                path_format_arguments = {
2354                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2355                    'name': self._serialize.url("name", name, 'str'),
2356                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2357                }
2358                url = self._client.format_url(url, **path_format_arguments)
2359                # Construct parameters
2360                query_parameters = {}  # type: Dict[str, Any]
2361                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2362
2363                request = self._client.post(url, query_parameters, header_parameters)
2364            else:
2365                url = next_link
2366                query_parameters = {}  # type: Dict[str, Any]
2367                request = self._client.get(url, query_parameters, header_parameters)
2368            return request
2369
2370        async def extract_data(pipeline_response):
2371            deserialized = self._deserialize('WebAppCollection', pipeline_response)
2372            list_of_elem = deserialized.value
2373            if cls:
2374                list_of_elem = cls(list_of_elem)
2375            return deserialized.next_link or None, AsyncList(list_of_elem)
2376
2377        async def get_next(next_link=None):
2378            request = prepare_request(next_link)
2379
2380            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2381            response = pipeline_response.http_response
2382
2383            if response.status_code not in [200]:
2384                map_error(status_code=response.status_code, response=response, error_map=error_map)
2385                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2386
2387            return pipeline_response
2388
2389        polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
2390        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WebAppCollection"]
2391        lro_delay = kwargs.pop(
2392            'polling_interval',
2393            self._config.polling_interval
2394        )
2395        cont_token = kwargs.pop('continuation_token', None)  # type: Optional[str]
2396        if cont_token is None:
2397            raw_result = await self._suspend_initial(
2398                resource_group_name=resource_group_name,
2399                name=name,
2400                cls=lambda x,y,z: x,
2401                **kwargs
2402            )
2403
2404        kwargs.pop('error_map', None)
2405        kwargs.pop('content_type', None)
2406        def get_long_running_output(pipeline_response):
2407            async def internal_get_next(next_link=None):
2408                if next_link is None:
2409                    return pipeline_response
2410                else:
2411                    return await get_next(next_link)
2412
2413            return AsyncItemPaged(
2414                internal_get_next, extract_data
2415            )
2416        path_format_arguments = {
2417            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2418            'name': self._serialize.url("name", name, 'str'),
2419            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2420        }
2421
2422        if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
2423        elif polling is False: polling_method = AsyncNoPolling()
2424        else: polling_method = polling
2425        if cont_token:
2426            return AsyncLROPoller.from_continuation_token(
2427                polling_method=polling_method,
2428                continuation_token=cont_token,
2429                client=self._client,
2430                deserialization_callback=get_long_running_output
2431            )
2432        else:
2433            return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
2434    begin_suspend.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend'}  # type: ignore
2435
2436    def list_usages(
2437        self,
2438        resource_group_name: str,
2439        name: str,
2440        filter: Optional[str] = None,
2441        **kwargs: Any
2442    ) -> AsyncIterable["_models.CsmUsageQuotaCollection"]:
2443        """Get global usage metrics of an App Service Environment.
2444
2445        Get global usage metrics of an App Service Environment.
2446
2447        :param resource_group_name: Name of the resource group to which the resource belongs.
2448        :type resource_group_name: str
2449        :param name: Name of the App Service Environment.
2450        :type name: str
2451        :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata
2452         syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq
2453         '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq
2454         duration'[Hour|Minute|Day]'.
2455        :type filter: str
2456        :keyword callable cls: A custom type or function that will be passed the direct response
2457        :return: An iterator like instance of either CsmUsageQuotaCollection or the result of cls(response)
2458        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.CsmUsageQuotaCollection]
2459        :raises: ~azure.core.exceptions.HttpResponseError
2460        """
2461        cls = kwargs.pop('cls', None)  # type: ClsType["_models.CsmUsageQuotaCollection"]
2462        error_map = {
2463            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2464        }
2465        error_map.update(kwargs.pop('error_map', {}))
2466        api_version = "2016-09-01"
2467        accept = "application/json"
2468
2469        def prepare_request(next_link=None):
2470            # Construct headers
2471            header_parameters = {}  # type: Dict[str, Any]
2472            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2473
2474            if not next_link:
2475                # Construct URL
2476                url = self.list_usages.metadata['url']  # type: ignore
2477                path_format_arguments = {
2478                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2479                    'name': self._serialize.url("name", name, 'str'),
2480                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2481                }
2482                url = self._client.format_url(url, **path_format_arguments)
2483                # Construct parameters
2484                query_parameters = {}  # type: Dict[str, Any]
2485                if filter is not None:
2486                    query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
2487                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2488
2489                request = self._client.get(url, query_parameters, header_parameters)
2490            else:
2491                url = next_link
2492                query_parameters = {}  # type: Dict[str, Any]
2493                request = self._client.get(url, query_parameters, header_parameters)
2494            return request
2495
2496        async def extract_data(pipeline_response):
2497            deserialized = self._deserialize('CsmUsageQuotaCollection', pipeline_response)
2498            list_of_elem = deserialized.value
2499            if cls:
2500                list_of_elem = cls(list_of_elem)
2501            return deserialized.next_link or None, AsyncList(list_of_elem)
2502
2503        async def get_next(next_link=None):
2504            request = prepare_request(next_link)
2505
2506            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2507            response = pipeline_response.http_response
2508
2509            if response.status_code not in [200]:
2510                map_error(status_code=response.status_code, response=response, error_map=error_map)
2511                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2512
2513            return pipeline_response
2514
2515        return AsyncItemPaged(
2516            get_next, extract_data
2517        )
2518    list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages'}  # type: ignore
2519
2520    def list_worker_pools(
2521        self,
2522        resource_group_name: str,
2523        name: str,
2524        **kwargs: Any
2525    ) -> AsyncIterable["_models.WorkerPoolCollection"]:
2526        """Get all worker pools of an App Service Environment.
2527
2528        Get all worker pools of an App Service Environment.
2529
2530        :param resource_group_name: Name of the resource group to which the resource belongs.
2531        :type resource_group_name: str
2532        :param name: Name of the App Service Environment.
2533        :type name: str
2534        :keyword callable cls: A custom type or function that will be passed the direct response
2535        :return: An iterator like instance of either WorkerPoolCollection or the result of cls(response)
2536        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.WorkerPoolCollection]
2537        :raises: ~azure.core.exceptions.HttpResponseError
2538        """
2539        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WorkerPoolCollection"]
2540        error_map = {
2541            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2542        }
2543        error_map.update(kwargs.pop('error_map', {}))
2544        api_version = "2016-09-01"
2545        accept = "application/json"
2546
2547        def prepare_request(next_link=None):
2548            # Construct headers
2549            header_parameters = {}  # type: Dict[str, Any]
2550            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2551
2552            if not next_link:
2553                # Construct URL
2554                url = self.list_worker_pools.metadata['url']  # type: ignore
2555                path_format_arguments = {
2556                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2557                    'name': self._serialize.url("name", name, 'str'),
2558                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2559                }
2560                url = self._client.format_url(url, **path_format_arguments)
2561                # Construct parameters
2562                query_parameters = {}  # type: Dict[str, Any]
2563                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2564
2565                request = self._client.get(url, query_parameters, header_parameters)
2566            else:
2567                url = next_link
2568                query_parameters = {}  # type: Dict[str, Any]
2569                request = self._client.get(url, query_parameters, header_parameters)
2570            return request
2571
2572        async def extract_data(pipeline_response):
2573            deserialized = self._deserialize('WorkerPoolCollection', pipeline_response)
2574            list_of_elem = deserialized.value
2575            if cls:
2576                list_of_elem = cls(list_of_elem)
2577            return deserialized.next_link or None, AsyncList(list_of_elem)
2578
2579        async def get_next(next_link=None):
2580            request = prepare_request(next_link)
2581
2582            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2583            response = pipeline_response.http_response
2584
2585            if response.status_code not in [200]:
2586                map_error(status_code=response.status_code, response=response, error_map=error_map)
2587                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2588
2589            return pipeline_response
2590
2591        return AsyncItemPaged(
2592            get_next, extract_data
2593        )
2594    list_worker_pools.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools'}  # type: ignore
2595
2596    async def get_worker_pool(
2597        self,
2598        resource_group_name: str,
2599        name: str,
2600        worker_pool_name: str,
2601        **kwargs: Any
2602    ) -> "_models.WorkerPoolResource":
2603        """Get properties of a worker pool.
2604
2605        Get properties of a worker pool.
2606
2607        :param resource_group_name: Name of the resource group to which the resource belongs.
2608        :type resource_group_name: str
2609        :param name: Name of the App Service Environment.
2610        :type name: str
2611        :param worker_pool_name: Name of the worker pool.
2612        :type worker_pool_name: str
2613        :keyword callable cls: A custom type or function that will be passed the direct response
2614        :return: WorkerPoolResource, or the result of cls(response)
2615        :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource
2616        :raises: ~azure.core.exceptions.HttpResponseError
2617        """
2618        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WorkerPoolResource"]
2619        error_map = {
2620            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2621        }
2622        error_map.update(kwargs.pop('error_map', {}))
2623        api_version = "2016-09-01"
2624        accept = "application/json"
2625
2626        # Construct URL
2627        url = self.get_worker_pool.metadata['url']  # type: ignore
2628        path_format_arguments = {
2629            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2630            'name': self._serialize.url("name", name, 'str'),
2631            'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
2632            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2633        }
2634        url = self._client.format_url(url, **path_format_arguments)
2635
2636        # Construct parameters
2637        query_parameters = {}  # type: Dict[str, Any]
2638        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2639
2640        # Construct headers
2641        header_parameters = {}  # type: Dict[str, Any]
2642        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2643
2644        request = self._client.get(url, query_parameters, header_parameters)
2645        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2646        response = pipeline_response.http_response
2647
2648        if response.status_code not in [200]:
2649            map_error(status_code=response.status_code, response=response, error_map=error_map)
2650            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2651
2652        deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
2653
2654        if cls:
2655            return cls(pipeline_response, deserialized, {})
2656
2657        return deserialized
2658    get_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'}  # type: ignore
2659
2660    async def _create_or_update_worker_pool_initial(
2661        self,
2662        resource_group_name: str,
2663        name: str,
2664        worker_pool_name: str,
2665        worker_pool_envelope: "_models.WorkerPoolResource",
2666        **kwargs: Any
2667    ) -> Optional["_models.WorkerPoolResource"]:
2668        cls = kwargs.pop('cls', None)  # type: ClsType[Optional["_models.WorkerPoolResource"]]
2669        error_map = {
2670            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2671        }
2672        error_map.update(kwargs.pop('error_map', {}))
2673        api_version = "2016-09-01"
2674        content_type = kwargs.pop("content_type", "application/json")
2675        accept = "application/json"
2676
2677        # Construct URL
2678        url = self._create_or_update_worker_pool_initial.metadata['url']  # type: ignore
2679        path_format_arguments = {
2680            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2681            'name': self._serialize.url("name", name, 'str'),
2682            'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
2683            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2684        }
2685        url = self._client.format_url(url, **path_format_arguments)
2686
2687        # Construct parameters
2688        query_parameters = {}  # type: Dict[str, Any]
2689        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2690
2691        # Construct headers
2692        header_parameters = {}  # type: Dict[str, Any]
2693        header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
2694        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2695
2696        body_content_kwargs = {}  # type: Dict[str, Any]
2697        body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource')
2698        body_content_kwargs['content'] = body_content
2699        request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
2700        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2701        response = pipeline_response.http_response
2702
2703        if response.status_code not in [200, 202, 400, 404, 409]:
2704            map_error(status_code=response.status_code, response=response, error_map=error_map)
2705            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2706
2707        deserialized = None
2708        if response.status_code == 200:
2709            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
2710
2711        if response.status_code == 202:
2712            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
2713
2714        if cls:
2715            return cls(pipeline_response, deserialized, {})
2716
2717        return deserialized
2718    _create_or_update_worker_pool_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'}  # type: ignore
2719
2720    async def begin_create_or_update_worker_pool(
2721        self,
2722        resource_group_name: str,
2723        name: str,
2724        worker_pool_name: str,
2725        worker_pool_envelope: "_models.WorkerPoolResource",
2726        **kwargs: Any
2727    ) -> AsyncLROPoller["_models.WorkerPoolResource"]:
2728        """Create or update a worker pool.
2729
2730        Create or update a worker pool.
2731
2732        :param resource_group_name: Name of the resource group to which the resource belongs.
2733        :type resource_group_name: str
2734        :param name: Name of the App Service Environment.
2735        :type name: str
2736        :param worker_pool_name: Name of the worker pool.
2737        :type worker_pool_name: str
2738        :param worker_pool_envelope: Properties of the worker pool.
2739        :type worker_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource
2740        :keyword callable cls: A custom type or function that will be passed the direct response
2741        :keyword str continuation_token: A continuation token to restart a poller from a saved state.
2742        :keyword polling: By default, your polling method will be AsyncARMPolling.
2743         Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
2744        :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
2745        :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
2746        :return: An instance of AsyncLROPoller that returns either WorkerPoolResource or the result of cls(response)
2747        :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource]
2748        :raises ~azure.core.exceptions.HttpResponseError:
2749        """
2750        polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
2751        cls = kwargs.pop('cls', None)  # type: ClsType["_models.WorkerPoolResource"]
2752        lro_delay = kwargs.pop(
2753            'polling_interval',
2754            self._config.polling_interval
2755        )
2756        cont_token = kwargs.pop('continuation_token', None)  # type: Optional[str]
2757        if cont_token is None:
2758            raw_result = await self._create_or_update_worker_pool_initial(
2759                resource_group_name=resource_group_name,
2760                name=name,
2761                worker_pool_name=worker_pool_name,
2762                worker_pool_envelope=worker_pool_envelope,
2763                cls=lambda x,y,z: x,
2764                **kwargs
2765            )
2766
2767        kwargs.pop('error_map', None)
2768        kwargs.pop('content_type', None)
2769
2770        def get_long_running_output(pipeline_response):
2771            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
2772
2773            if cls:
2774                return cls(pipeline_response, deserialized, {})
2775            return deserialized
2776
2777        path_format_arguments = {
2778            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2779            'name': self._serialize.url("name", name, 'str'),
2780            'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
2781            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2782        }
2783
2784        if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
2785        elif polling is False: polling_method = AsyncNoPolling()
2786        else: polling_method = polling
2787        if cont_token:
2788            return AsyncLROPoller.from_continuation_token(
2789                polling_method=polling_method,
2790                continuation_token=cont_token,
2791                client=self._client,
2792                deserialization_callback=get_long_running_output
2793            )
2794        else:
2795            return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
2796    begin_create_or_update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'}  # type: ignore
2797
2798    async def update_worker_pool(
2799        self,
2800        resource_group_name: str,
2801        name: str,
2802        worker_pool_name: str,
2803        worker_pool_envelope: "_models.WorkerPoolResource",
2804        **kwargs: Any
2805    ) -> Optional["_models.WorkerPoolResource"]:
2806        """Create or update a worker pool.
2807
2808        Create or update a worker pool.
2809
2810        :param resource_group_name: Name of the resource group to which the resource belongs.
2811        :type resource_group_name: str
2812        :param name: Name of the App Service Environment.
2813        :type name: str
2814        :param worker_pool_name: Name of the worker pool.
2815        :type worker_pool_name: str
2816        :param worker_pool_envelope: Properties of the worker pool.
2817        :type worker_pool_envelope: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource
2818        :keyword callable cls: A custom type or function that will be passed the direct response
2819        :return: WorkerPoolResource, or the result of cls(response)
2820        :rtype: ~azure.mgmt.web.v2016_09_01.models.WorkerPoolResource or None
2821        :raises: ~azure.core.exceptions.HttpResponseError
2822        """
2823        cls = kwargs.pop('cls', None)  # type: ClsType[Optional["_models.WorkerPoolResource"]]
2824        error_map = {
2825            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2826        }
2827        error_map.update(kwargs.pop('error_map', {}))
2828        api_version = "2016-09-01"
2829        content_type = kwargs.pop("content_type", "application/json")
2830        accept = "application/json"
2831
2832        # Construct URL
2833        url = self.update_worker_pool.metadata['url']  # type: ignore
2834        path_format_arguments = {
2835            'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2836            'name': self._serialize.url("name", name, 'str'),
2837            'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
2838            'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2839        }
2840        url = self._client.format_url(url, **path_format_arguments)
2841
2842        # Construct parameters
2843        query_parameters = {}  # type: Dict[str, Any]
2844        query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2845
2846        # Construct headers
2847        header_parameters = {}  # type: Dict[str, Any]
2848        header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
2849        header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2850
2851        body_content_kwargs = {}  # type: Dict[str, Any]
2852        body_content = self._serialize.body(worker_pool_envelope, 'WorkerPoolResource')
2853        body_content_kwargs['content'] = body_content
2854        request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)
2855        pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2856        response = pipeline_response.http_response
2857
2858        if response.status_code not in [200, 202, 400, 404, 409]:
2859            map_error(status_code=response.status_code, response=response, error_map=error_map)
2860            raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2861
2862        deserialized = None
2863        if response.status_code == 200:
2864            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
2865
2866        if response.status_code == 202:
2867            deserialized = self._deserialize('WorkerPoolResource', pipeline_response)
2868
2869        if cls:
2870            return cls(pipeline_response, deserialized, {})
2871
2872        return deserialized
2873    update_worker_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}'}  # type: ignore
2874
2875    def list_worker_pool_instance_metric_definitions(
2876        self,
2877        resource_group_name: str,
2878        name: str,
2879        worker_pool_name: str,
2880        instance: str,
2881        **kwargs: Any
2882    ) -> AsyncIterable["_models.ResourceMetricDefinitionCollection"]:
2883        """Get metric definitions for a specific instance of a worker pool of an App Service Environment.
2884
2885        Get metric definitions for a specific instance of a worker pool of an App Service Environment.
2886
2887        :param resource_group_name: Name of the resource group to which the resource belongs.
2888        :type resource_group_name: str
2889        :param name: Name of the App Service Environment.
2890        :type name: str
2891        :param worker_pool_name: Name of the worker pool.
2892        :type worker_pool_name: str
2893        :param instance: Name of the instance in the worker pool.
2894        :type instance: str
2895        :keyword callable cls: A custom type or function that will be passed the direct response
2896        :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response)
2897        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection]
2898        :raises: ~azure.core.exceptions.HttpResponseError
2899        """
2900        cls = kwargs.pop('cls', None)  # type: ClsType["_models.ResourceMetricDefinitionCollection"]
2901        error_map = {
2902            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2903        }
2904        error_map.update(kwargs.pop('error_map', {}))
2905        api_version = "2016-09-01"
2906        accept = "application/json"
2907
2908        def prepare_request(next_link=None):
2909            # Construct headers
2910            header_parameters = {}  # type: Dict[str, Any]
2911            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
2912
2913            if not next_link:
2914                # Construct URL
2915                url = self.list_worker_pool_instance_metric_definitions.metadata['url']  # type: ignore
2916                path_format_arguments = {
2917                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
2918                    'name': self._serialize.url("name", name, 'str'),
2919                    'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
2920                    'instance': self._serialize.url("instance", instance, 'str'),
2921                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
2922                }
2923                url = self._client.format_url(url, **path_format_arguments)
2924                # Construct parameters
2925                query_parameters = {}  # type: Dict[str, Any]
2926                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
2927
2928                request = self._client.get(url, query_parameters, header_parameters)
2929            else:
2930                url = next_link
2931                query_parameters = {}  # type: Dict[str, Any]
2932                request = self._client.get(url, query_parameters, header_parameters)
2933            return request
2934
2935        async def extract_data(pipeline_response):
2936            deserialized = self._deserialize('ResourceMetricDefinitionCollection', pipeline_response)
2937            list_of_elem = deserialized.value
2938            if cls:
2939                list_of_elem = cls(list_of_elem)
2940            return deserialized.next_link or None, AsyncList(list_of_elem)
2941
2942        async def get_next(next_link=None):
2943            request = prepare_request(next_link)
2944
2945            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
2946            response = pipeline_response.http_response
2947
2948            if response.status_code not in [200]:
2949                map_error(status_code=response.status_code, response=response, error_map=error_map)
2950                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
2951
2952            return pipeline_response
2953
2954        return AsyncItemPaged(
2955            get_next, extract_data
2956        )
2957    list_worker_pool_instance_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions'}  # type: ignore
2958
2959    def list_worker_pool_instance_metrics(
2960        self,
2961        resource_group_name: str,
2962        name: str,
2963        worker_pool_name: str,
2964        instance: str,
2965        details: Optional[bool] = None,
2966        filter: Optional[str] = None,
2967        **kwargs: Any
2968    ) -> AsyncIterable["_models.ResourceMetricCollection"]:
2969        """Get metrics for a specific instance of a worker pool of an App Service Environment.
2970
2971        Get metrics for a specific instance of a worker pool of an App Service Environment.
2972
2973        :param resource_group_name: Name of the resource group to which the resource belongs.
2974        :type resource_group_name: str
2975        :param name: Name of the App Service Environment.
2976        :type name: str
2977        :param worker_pool_name: Name of the worker pool.
2978        :type worker_pool_name: str
2979        :param instance: Name of the instance in the worker pool.
2980        :type instance: str
2981        :param details: Specify :code:`<code>true</code>` to include instance details. The default is
2982         :code:`<code>false</code>`.
2983        :type details: bool
2984        :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata
2985         syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq
2986         '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq
2987         duration'[Hour|Minute|Day]'.
2988        :type filter: str
2989        :keyword callable cls: A custom type or function that will be passed the direct response
2990        :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response)
2991        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection]
2992        :raises: ~azure.core.exceptions.HttpResponseError
2993        """
2994        cls = kwargs.pop('cls', None)  # type: ClsType["_models.ResourceMetricCollection"]
2995        error_map = {
2996            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
2997        }
2998        error_map.update(kwargs.pop('error_map', {}))
2999        api_version = "2016-09-01"
3000        accept = "application/json"
3001
3002        def prepare_request(next_link=None):
3003            # Construct headers
3004            header_parameters = {}  # type: Dict[str, Any]
3005            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
3006
3007            if not next_link:
3008                # Construct URL
3009                url = self.list_worker_pool_instance_metrics.metadata['url']  # type: ignore
3010                path_format_arguments = {
3011                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
3012                    'name': self._serialize.url("name", name, 'str'),
3013                    'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
3014                    'instance': self._serialize.url("instance", instance, 'str'),
3015                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
3016                }
3017                url = self._client.format_url(url, **path_format_arguments)
3018                # Construct parameters
3019                query_parameters = {}  # type: Dict[str, Any]
3020                if details is not None:
3021                    query_parameters['details'] = self._serialize.query("details", details, 'bool')
3022                if filter is not None:
3023                    query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
3024                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
3025
3026                request = self._client.get(url, query_parameters, header_parameters)
3027            else:
3028                url = next_link
3029                query_parameters = {}  # type: Dict[str, Any]
3030                request = self._client.get(url, query_parameters, header_parameters)
3031            return request
3032
3033        async def extract_data(pipeline_response):
3034            deserialized = self._deserialize('ResourceMetricCollection', pipeline_response)
3035            list_of_elem = deserialized.value
3036            if cls:
3037                list_of_elem = cls(list_of_elem)
3038            return deserialized.next_link or None, AsyncList(list_of_elem)
3039
3040        async def get_next(next_link=None):
3041            request = prepare_request(next_link)
3042
3043            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
3044            response = pipeline_response.http_response
3045
3046            if response.status_code not in [200]:
3047                map_error(status_code=response.status_code, response=response, error_map=error_map)
3048                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
3049
3050            return pipeline_response
3051
3052        return AsyncItemPaged(
3053            get_next, extract_data
3054        )
3055    list_worker_pool_instance_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metrics'}  # type: ignore
3056
3057    def list_web_worker_metric_definitions(
3058        self,
3059        resource_group_name: str,
3060        name: str,
3061        worker_pool_name: str,
3062        **kwargs: Any
3063    ) -> AsyncIterable["_models.ResourceMetricDefinitionCollection"]:
3064        """Get metric definitions for a worker pool of an App Service Environment.
3065
3066        Get metric definitions for a worker pool of an App Service Environment.
3067
3068        :param resource_group_name: Name of the resource group to which the resource belongs.
3069        :type resource_group_name: str
3070        :param name: Name of the App Service Environment.
3071        :type name: str
3072        :param worker_pool_name: Name of the worker pool.
3073        :type worker_pool_name: str
3074        :keyword callable cls: A custom type or function that will be passed the direct response
3075        :return: An iterator like instance of either ResourceMetricDefinitionCollection or the result of cls(response)
3076        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricDefinitionCollection]
3077        :raises: ~azure.core.exceptions.HttpResponseError
3078        """
3079        cls = kwargs.pop('cls', None)  # type: ClsType["_models.ResourceMetricDefinitionCollection"]
3080        error_map = {
3081            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
3082        }
3083        error_map.update(kwargs.pop('error_map', {}))
3084        api_version = "2016-09-01"
3085        accept = "application/json"
3086
3087        def prepare_request(next_link=None):
3088            # Construct headers
3089            header_parameters = {}  # type: Dict[str, Any]
3090            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
3091
3092            if not next_link:
3093                # Construct URL
3094                url = self.list_web_worker_metric_definitions.metadata['url']  # type: ignore
3095                path_format_arguments = {
3096                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
3097                    'name': self._serialize.url("name", name, 'str'),
3098                    'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
3099                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
3100                }
3101                url = self._client.format_url(url, **path_format_arguments)
3102                # Construct parameters
3103                query_parameters = {}  # type: Dict[str, Any]
3104                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
3105
3106                request = self._client.get(url, query_parameters, header_parameters)
3107            else:
3108                url = next_link
3109                query_parameters = {}  # type: Dict[str, Any]
3110                request = self._client.get(url, query_parameters, header_parameters)
3111            return request
3112
3113        async def extract_data(pipeline_response):
3114            deserialized = self._deserialize('ResourceMetricDefinitionCollection', pipeline_response)
3115            list_of_elem = deserialized.value
3116            if cls:
3117                list_of_elem = cls(list_of_elem)
3118            return deserialized.next_link or None, AsyncList(list_of_elem)
3119
3120        async def get_next(next_link=None):
3121            request = prepare_request(next_link)
3122
3123            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
3124            response = pipeline_response.http_response
3125
3126            if response.status_code not in [200]:
3127                map_error(status_code=response.status_code, response=response, error_map=error_map)
3128                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
3129
3130            return pipeline_response
3131
3132        return AsyncItemPaged(
3133            get_next, extract_data
3134        )
3135    list_web_worker_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions'}  # type: ignore
3136
3137    def list_web_worker_metrics(
3138        self,
3139        resource_group_name: str,
3140        name: str,
3141        worker_pool_name: str,
3142        details: Optional[bool] = None,
3143        filter: Optional[str] = None,
3144        **kwargs: Any
3145    ) -> AsyncIterable["_models.ResourceMetricCollection"]:
3146        """Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment).
3147
3148        Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment).
3149
3150        :param resource_group_name: Name of the resource group to which the resource belongs.
3151        :type resource_group_name: str
3152        :param name: Name of the App Service Environment.
3153        :type name: str
3154        :param worker_pool_name: Name of worker pool.
3155        :type worker_pool_name: str
3156        :param details: Specify :code:`<code>true</code>` to include instance details. The default is
3157         :code:`<code>false</code>`.
3158        :type details: bool
3159        :param filter: Return only usages/metrics specified in the filter. Filter conforms to odata
3160         syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq
3161         '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq
3162         duration'[Hour|Minute|Day]'.
3163        :type filter: str
3164        :keyword callable cls: A custom type or function that will be passed the direct response
3165        :return: An iterator like instance of either ResourceMetricCollection or the result of cls(response)
3166        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.ResourceMetricCollection]
3167        :raises: ~azure.core.exceptions.HttpResponseError
3168        """
3169        cls = kwargs.pop('cls', None)  # type: ClsType["_models.ResourceMetricCollection"]
3170        error_map = {
3171            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
3172        }
3173        error_map.update(kwargs.pop('error_map', {}))
3174        api_version = "2016-09-01"
3175        accept = "application/json"
3176
3177        def prepare_request(next_link=None):
3178            # Construct headers
3179            header_parameters = {}  # type: Dict[str, Any]
3180            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
3181
3182            if not next_link:
3183                # Construct URL
3184                url = self.list_web_worker_metrics.metadata['url']  # type: ignore
3185                path_format_arguments = {
3186                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
3187                    'name': self._serialize.url("name", name, 'str'),
3188                    'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
3189                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
3190                }
3191                url = self._client.format_url(url, **path_format_arguments)
3192                # Construct parameters
3193                query_parameters = {}  # type: Dict[str, Any]
3194                if details is not None:
3195                    query_parameters['details'] = self._serialize.query("details", details, 'bool')
3196                if filter is not None:
3197                    query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
3198                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
3199
3200                request = self._client.get(url, query_parameters, header_parameters)
3201            else:
3202                url = next_link
3203                query_parameters = {}  # type: Dict[str, Any]
3204                request = self._client.get(url, query_parameters, header_parameters)
3205            return request
3206
3207        async def extract_data(pipeline_response):
3208            deserialized = self._deserialize('ResourceMetricCollection', pipeline_response)
3209            list_of_elem = deserialized.value
3210            if cls:
3211                list_of_elem = cls(list_of_elem)
3212            return deserialized.next_link or None, AsyncList(list_of_elem)
3213
3214        async def get_next(next_link=None):
3215            request = prepare_request(next_link)
3216
3217            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
3218            response = pipeline_response.http_response
3219
3220            if response.status_code not in [200]:
3221                map_error(status_code=response.status_code, response=response, error_map=error_map)
3222                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
3223
3224            return pipeline_response
3225
3226        return AsyncItemPaged(
3227            get_next, extract_data
3228        )
3229    list_web_worker_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics'}  # type: ignore
3230
3231    def list_worker_pool_skus(
3232        self,
3233        resource_group_name: str,
3234        name: str,
3235        worker_pool_name: str,
3236        **kwargs: Any
3237    ) -> AsyncIterable["_models.SkuInfoCollection"]:
3238        """Get available SKUs for scaling a worker pool.
3239
3240        Get available SKUs for scaling a worker pool.
3241
3242        :param resource_group_name: Name of the resource group to which the resource belongs.
3243        :type resource_group_name: str
3244        :param name: Name of the App Service Environment.
3245        :type name: str
3246        :param worker_pool_name: Name of the worker pool.
3247        :type worker_pool_name: str
3248        :keyword callable cls: A custom type or function that will be passed the direct response
3249        :return: An iterator like instance of either SkuInfoCollection or the result of cls(response)
3250        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.SkuInfoCollection]
3251        :raises: ~azure.core.exceptions.HttpResponseError
3252        """
3253        cls = kwargs.pop('cls', None)  # type: ClsType["_models.SkuInfoCollection"]
3254        error_map = {
3255            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
3256        }
3257        error_map.update(kwargs.pop('error_map', {}))
3258        api_version = "2016-09-01"
3259        accept = "application/json"
3260
3261        def prepare_request(next_link=None):
3262            # Construct headers
3263            header_parameters = {}  # type: Dict[str, Any]
3264            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
3265
3266            if not next_link:
3267                # Construct URL
3268                url = self.list_worker_pool_skus.metadata['url']  # type: ignore
3269                path_format_arguments = {
3270                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
3271                    'name': self._serialize.url("name", name, 'str'),
3272                    'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
3273                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
3274                }
3275                url = self._client.format_url(url, **path_format_arguments)
3276                # Construct parameters
3277                query_parameters = {}  # type: Dict[str, Any]
3278                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
3279
3280                request = self._client.get(url, query_parameters, header_parameters)
3281            else:
3282                url = next_link
3283                query_parameters = {}  # type: Dict[str, Any]
3284                request = self._client.get(url, query_parameters, header_parameters)
3285            return request
3286
3287        async def extract_data(pipeline_response):
3288            deserialized = self._deserialize('SkuInfoCollection', pipeline_response)
3289            list_of_elem = deserialized.value
3290            if cls:
3291                list_of_elem = cls(list_of_elem)
3292            return deserialized.next_link or None, AsyncList(list_of_elem)
3293
3294        async def get_next(next_link=None):
3295            request = prepare_request(next_link)
3296
3297            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
3298            response = pipeline_response.http_response
3299
3300            if response.status_code not in [200]:
3301                map_error(status_code=response.status_code, response=response, error_map=error_map)
3302                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
3303
3304            return pipeline_response
3305
3306        return AsyncItemPaged(
3307            get_next, extract_data
3308        )
3309    list_worker_pool_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus'}  # type: ignore
3310
3311    def list_web_worker_usages(
3312        self,
3313        resource_group_name: str,
3314        name: str,
3315        worker_pool_name: str,
3316        **kwargs: Any
3317    ) -> AsyncIterable["_models.UsageCollection"]:
3318        """Get usage metrics for a worker pool of an App Service Environment.
3319
3320        Get usage metrics for a worker pool of an App Service Environment.
3321
3322        :param resource_group_name: Name of the resource group to which the resource belongs.
3323        :type resource_group_name: str
3324        :param name: Name of the App Service Environment.
3325        :type name: str
3326        :param worker_pool_name: Name of the worker pool.
3327        :type worker_pool_name: str
3328        :keyword callable cls: A custom type or function that will be passed the direct response
3329        :return: An iterator like instance of either UsageCollection or the result of cls(response)
3330        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.web.v2016_09_01.models.UsageCollection]
3331        :raises: ~azure.core.exceptions.HttpResponseError
3332        """
3333        cls = kwargs.pop('cls', None)  # type: ClsType["_models.UsageCollection"]
3334        error_map = {
3335            401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
3336        }
3337        error_map.update(kwargs.pop('error_map', {}))
3338        api_version = "2016-09-01"
3339        accept = "application/json"
3340
3341        def prepare_request(next_link=None):
3342            # Construct headers
3343            header_parameters = {}  # type: Dict[str, Any]
3344            header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
3345
3346            if not next_link:
3347                # Construct URL
3348                url = self.list_web_worker_usages.metadata['url']  # type: ignore
3349                path_format_arguments = {
3350                    'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
3351                    'name': self._serialize.url("name", name, 'str'),
3352                    'workerPoolName': self._serialize.url("worker_pool_name", worker_pool_name, 'str'),
3353                    'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
3354                }
3355                url = self._client.format_url(url, **path_format_arguments)
3356                # Construct parameters
3357                query_parameters = {}  # type: Dict[str, Any]
3358                query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
3359
3360                request = self._client.get(url, query_parameters, header_parameters)
3361            else:
3362                url = next_link
3363                query_parameters = {}  # type: Dict[str, Any]
3364                request = self._client.get(url, query_parameters, header_parameters)
3365            return request
3366
3367        async def extract_data(pipeline_response):
3368            deserialized = self._deserialize('UsageCollection', pipeline_response)
3369            list_of_elem = deserialized.value
3370            if cls:
3371                list_of_elem = cls(list_of_elem)
3372            return deserialized.next_link or None, AsyncList(list_of_elem)
3373
3374        async def get_next(next_link=None):
3375            request = prepare_request(next_link)
3376
3377            pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
3378            response = pipeline_response.http_response
3379
3380            if response.status_code not in [200]:
3381                map_error(status_code=response.status_code, response=response, error_map=error_map)
3382                raise HttpResponseError(response=response, error_format=ARMErrorFormat)
3383
3384            return pipeline_response
3385
3386        return AsyncItemPaged(
3387            get_next, extract_data
3388        )
3389    list_web_worker_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages'}  # type: ignore
3390