diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json index c300862c81aa..f2fe7e212080 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json @@ -49,11 +49,9 @@ "operation_mixins": { "list_operations" : { "sync": { - "operation_name": "list_operations", "signature": "def list_operations(\n self,\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "list_operations", "signature": "def list_operations(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.OperationListResult\"]:\n", "coroutine": false }, @@ -61,6 +59,6 @@ "call": "" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.paging import ItemPaged\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\nfrom azure.mgmt.core.exceptions import ARMErrorFormat\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar", - "async_imports": "from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.async_paging import AsyncItemPaged, AsyncList\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest\nfrom azure.mgmt.core.exceptions import ARMErrorFormat" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations_async/_feature_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations_async/_feature_client_operations_async.py index 96ee2ac4a9b2..0064b690de8d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations_async/_feature_client_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations_async/_feature_client_operations_async.py @@ -38,6 +38,10 @@ def list_operations( api_version = "2015-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_operations.metadata['url'] # type: ignore @@ -45,15 +49,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations_async/_features_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations_async/_features_operations_async.py index 8544f9092b59..1b3b65043743 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations_async/_features_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations_async/_features_operations_async.py @@ -58,6 +58,10 @@ def list_all( api_version = "2015-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_all.metadata['url'] # type: ignore @@ -69,15 +73,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -126,6 +126,10 @@ def list( api_version = "2015-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -138,15 +142,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -212,7 +212,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -268,7 +267,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -324,7 +322,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_feature_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_feature_client_operations.py index 728a5774e7d3..86dc038f21a5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_feature_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_feature_client_operations.py @@ -43,6 +43,10 @@ def list_operations( api_version = "2015-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_operations.metadata['url'] # type: ignore @@ -50,15 +54,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_features_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_features_operations.py index 7d96e8d32661..a4fd096761cf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_features_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_features_operations.py @@ -63,6 +63,10 @@ def list_all( api_version = "2015-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_all.metadata['url'] # type: ignore @@ -74,15 +78,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -132,6 +132,10 @@ def list( api_version = "2015-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -144,15 +148,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -219,7 +219,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -276,7 +275,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -333,7 +331,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations_async/_operations_async.py index 2ce4d8999383..1e8aca19d7a3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations_async/_resource_links_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations_async/_resource_links_operations_async.py index 5a2babfa652a..b027f247bc1f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations_async/_resource_links_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations_async/_resource_links_operations_async.py @@ -77,7 +77,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -133,7 +132,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceLink') body_content_kwargs['content'] = body_content @@ -146,7 +144,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceLink', pipeline_response) @@ -194,7 +191,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,6 +228,10 @@ def list_at_subscription( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription.metadata['url'] # type: ignore @@ -245,15 +245,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -306,6 +302,10 @@ def list_at_source_scope( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_source_scope.metadata['url'] # type: ignore @@ -319,15 +319,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py index 9e06f0e3c650..75584d1217cd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_resource_links_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_resource_links_operations.py index 040eedd0a87f..e587e5977097 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_resource_links_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_resource_links_operations.py @@ -82,7 +82,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -139,7 +138,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceLink') body_content_kwargs['content'] = body_content @@ -152,7 +150,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceLink', pipeline_response) @@ -201,7 +198,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,6 +236,10 @@ def list_at_subscription( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription.metadata['url'] # type: ignore @@ -253,15 +253,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -315,6 +311,10 @@ def list_at_source_scope( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_source_scope.metadata['url'] # type: ignore @@ -328,15 +328,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations_async/_management_locks_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations_async/_management_locks_operations_async.py index b5f6751747e2..f4ccfc8af37a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations_async/_management_locks_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations_async/_management_locks_operations_async.py @@ -85,7 +85,6 @@ async def create_or_update_at_resource_group_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -98,7 +97,6 @@ async def create_or_update_at_resource_group_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -149,7 +147,6 @@ async def delete_at_resource_group_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +199,6 @@ async def get_at_resource_group_level( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -279,7 +275,6 @@ async def create_or_update_at_resource_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -292,7 +287,6 @@ async def create_or_update_at_resource_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -359,7 +353,6 @@ async def delete_at_resource_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,7 +406,6 @@ async def create_or_update_at_subscription_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -426,7 +418,6 @@ async def create_or_update_at_subscription_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -473,7 +464,6 @@ async def delete_at_subscription_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -522,7 +512,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -562,6 +551,10 @@ def list_at_resource_group_level( api_version = "2015-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_resource_group_level.metadata['url'] # type: ignore @@ -576,15 +569,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -646,6 +635,10 @@ def list_at_resource_level( api_version = "2015-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_resource_level.metadata['url'] # type: ignore @@ -664,15 +657,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -719,6 +708,10 @@ def list_at_subscription_level( api_version = "2015-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_level.metadata['url'] # type: ignore @@ -732,15 +725,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_management_locks_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_management_locks_operations.py index c249418b0972..5672dc45340d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_management_locks_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_management_locks_operations.py @@ -90,7 +90,6 @@ def create_or_update_at_resource_group_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -103,7 +102,6 @@ def create_or_update_at_resource_group_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -155,7 +153,6 @@ def delete_at_resource_group_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +206,6 @@ def get_at_resource_group_level( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,7 +283,6 @@ def create_or_update_at_resource_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -300,7 +295,6 @@ def create_or_update_at_resource_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -368,7 +362,6 @@ def delete_at_resource_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,7 +416,6 @@ def create_or_update_at_subscription_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -436,7 +428,6 @@ def create_or_update_at_subscription_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -484,7 +475,6 @@ def delete_at_subscription_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -534,7 +524,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -575,6 +564,10 @@ def list_at_resource_group_level( api_version = "2015-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_resource_group_level.metadata['url'] # type: ignore @@ -589,15 +582,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -660,6 +649,10 @@ def list_at_resource_level( api_version = "2015-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_resource_level.metadata['url'] # type: ignore @@ -678,15 +671,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -734,6 +723,10 @@ def list_at_subscription_level( api_version = "2015-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_level.metadata['url'] # type: ignore @@ -747,15 +740,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations_async/_authorization_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations_async/_authorization_operations_operations_async.py index fc5d35ca4f60..dcdaa955c246 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations_async/_authorization_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations_async/_authorization_operations_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations_async/_management_locks_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations_async/_management_locks_operations_async.py index 9883ec4cf8c5..9586e56175c2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations_async/_management_locks_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations_async/_management_locks_operations_async.py @@ -91,7 +91,6 @@ async def create_or_update_at_resource_group_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -104,7 +103,6 @@ async def create_or_update_at_resource_group_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -159,7 +157,6 @@ async def delete_at_resource_group_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,7 +209,6 @@ async def get_at_resource_group_level( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -276,7 +272,6 @@ async def create_or_update_by_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -289,7 +284,6 @@ async def create_or_update_by_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -339,7 +333,6 @@ async def delete_by_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -391,7 +384,6 @@ async def get_by_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -474,7 +466,6 @@ async def create_or_update_at_resource_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -487,7 +478,6 @@ async def create_or_update_at_resource_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -560,7 +550,6 @@ async def delete_at_resource_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -630,7 +619,6 @@ async def get_at_resource_level( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -693,7 +681,6 @@ async def create_or_update_at_subscription_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -706,7 +693,6 @@ async def create_or_update_at_subscription_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -757,7 +743,6 @@ async def delete_at_subscription_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -806,7 +791,6 @@ async def get_at_subscription_level( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -846,6 +830,10 @@ def list_at_resource_group_level( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_resource_group_level.metadata['url'] # type: ignore @@ -860,15 +848,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -931,6 +915,10 @@ def list_at_resource_level( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_resource_level.metadata['url'] # type: ignore @@ -949,15 +937,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1004,6 +988,10 @@ def list_at_subscription_level( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_level.metadata['url'] # type: ignore @@ -1017,15 +1005,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1079,6 +1063,10 @@ def list_by_scope( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_scope.metadata['url'] # type: ignore @@ -1092,15 +1080,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_authorization_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_authorization_operations_operations.py index 94b733fa5955..97872581f81e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_authorization_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_authorization_operations_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_management_locks_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_management_locks_operations.py index d533a0059e0a..f39afa098ab3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_management_locks_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_management_locks_operations.py @@ -96,7 +96,6 @@ def create_or_update_at_resource_group_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -109,7 +108,6 @@ def create_or_update_at_resource_group_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -165,7 +163,6 @@ def delete_at_resource_group_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -219,7 +216,6 @@ def get_at_resource_group_level( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -284,7 +280,6 @@ def create_or_update_by_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -297,7 +292,6 @@ def create_or_update_by_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -348,7 +342,6 @@ def delete_by_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -401,7 +394,6 @@ def get_by_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -485,7 +477,6 @@ def create_or_update_at_resource_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -498,7 +489,6 @@ def create_or_update_at_resource_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -572,7 +562,6 @@ def delete_at_resource_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -643,7 +632,6 @@ def get_at_resource_level( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -707,7 +695,6 @@ def create_or_update_at_subscription_level( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ManagementLockObject') body_content_kwargs['content'] = body_content @@ -720,7 +707,6 @@ def create_or_update_at_subscription_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ManagementLockObject', pipeline_response) @@ -772,7 +758,6 @@ def delete_at_subscription_level( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -822,7 +807,6 @@ def get_at_subscription_level( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -863,6 +847,10 @@ def list_at_resource_group_level( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_resource_group_level.metadata['url'] # type: ignore @@ -877,15 +865,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -949,6 +933,10 @@ def list_at_resource_level( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_resource_level.metadata['url'] # type: ignore @@ -967,15 +955,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1023,6 +1007,10 @@ def list_at_subscription_level( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_level.metadata['url'] # type: ignore @@ -1036,15 +1024,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1099,6 +1083,10 @@ def list_by_scope( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_scope.metadata['url'] # type: ignore @@ -1112,15 +1100,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py index e5e3cde798fe..907a527ef6a0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py @@ -18,12 +18,13 @@ from azure.core.credentials import TokenCredential from ._configuration import ApplicationClientConfiguration +from .operations import ApplicationClientOperationsMixin from .operations import ApplicationsOperations from .operations import ApplicationDefinitionsOperations from . import models -class ApplicationClient(object): +class ApplicationClient(ApplicationClientOperationsMixin): """ARM applications. :ivar applications: ApplicationsOperations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_metadata.json index f2494f96bbb6..5f81fa25b971 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_metadata.json @@ -48,7 +48,18 @@ "application_definitions": "ApplicationDefinitionsOperations" }, "operation_mixins": { + "list_operations" : { + "sync": { + "signature": "def list_operations(\n self,\n **kwargs # type: Any\n):\n" + }, + "async": { + "signature": "def list_operations(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.OperationListResult\"]:\n", + "coroutine": false + }, + "doc": " \"\"\"Lists all of the available Microsoft.Solutions REST API operations.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: OperationListResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.managedapplications.models.OperationListResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", + "call": "" + } }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client_async.py index 8f604093cf2c..58862a0bdcb6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client_async.py @@ -16,12 +16,13 @@ from azure.core.credentials_async import AsyncTokenCredential from ._configuration_async import ApplicationClientConfiguration +from .operations_async import ApplicationClientOperationsMixin from .operations_async import ApplicationsOperations from .operations_async import ApplicationDefinitionsOperations from .. import models -class ApplicationClient(object): +class ApplicationClient(ApplicationClientOperationsMixin): """ARM applications. :ivar applications: ApplicationsOperations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/__init__.py index 4b744d522ac8..b531d2d7b78c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/__init__.py @@ -6,10 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._application_client_operations_async import ApplicationClientOperationsMixin from ._applications_operations_async import ApplicationsOperations from ._application_definitions_operations_async import ApplicationDefinitionsOperations __all__ = [ + 'ApplicationClientOperationsMixin', 'ApplicationsOperations', 'ApplicationDefinitionsOperations', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_application_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_application_client_operations_async.py new file mode 100644 index 000000000000..298fcde84ae1 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_application_client_operations_async.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationClientOperationsMixin: + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["models.OperationListResult"]: + """Lists all of the available Microsoft.Solutions REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.managedapplications.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Solutions/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_application_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_application_definitions_operations_async.py index d83e4f6ff1fb..80f305c29ea3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_application_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_application_definitions_operations_async.py @@ -48,7 +48,7 @@ async def get( resource_group_name: str, application_definition_name: str, **kwargs - ) -> "models.ApplicationDefinition": + ) -> Optional["models.ApplicationDefinition"]: """Gets the managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,7 +60,7 @@ async def get( :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ApplicationDefinition"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -82,7 +82,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -129,7 +128,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -149,7 +147,7 @@ async def begin_delete( resource_group_name: str, application_definition_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes the managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -162,8 +160,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -233,7 +231,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ApplicationDefinition') body_content_kwargs['content'] = body_content @@ -247,7 +244,6 @@ async def _create_or_update_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ApplicationDefinition', pipeline_response) @@ -266,7 +262,7 @@ async def begin_create_or_update( application_definition_name: str, parameters: "models.ApplicationDefinition", **kwargs - ) -> "models.ApplicationDefinition": + ) -> AsyncLROPoller["models.ApplicationDefinition"]: """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -282,8 +278,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: ApplicationDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition + :return: An instance of AsyncLROPoller that returns either ApplicationDefinition or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.managedapplications.models.ApplicationDefinition] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -346,6 +342,10 @@ def list_by_resource_group( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -358,15 +358,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -396,22 +392,22 @@ async def get_next(next_link=None): async def get_by_id( self, - application_definition_id: str, + resource_group_name: str, + application_definition_name: str, **kwargs - ) -> "models.ApplicationDefinition": + ) -> Optional["models.ApplicationDefinition"]: """Gets the managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationDefinition, or the result of cls(response) :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ApplicationDefinition"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -419,7 +415,9 @@ async def get_by_id( # Construct URL url = self.get_by_id.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -431,7 +429,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -449,11 +446,12 @@ async def get_by_id( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore async def _delete_by_id_initial( self, - application_definition_id: str, + resource_group_name: str, + application_definition_name: str, **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -464,7 +462,9 @@ async def _delete_by_id_initial( # Construct URL url = self._delete_by_id_initial.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -475,7 +475,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -488,28 +487,28 @@ async def _delete_by_id_initial( if cls: return cls(pipeline_response, None, {}) - _delete_by_id_initial.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + _delete_by_id_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore async def begin_delete_by_id( self, - application_definition_id: str, + resource_group_name: str, + application_definition_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes the managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -521,7 +520,8 @@ async def begin_delete_by_id( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, cls=lambda x,y,z: x, **kwargs ) @@ -545,11 +545,12 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + begin_delete_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore async def _create_or_update_by_id_initial( self, - application_definition_id: str, + resource_group_name: str, + application_definition_name: str, parameters: "models.ApplicationDefinition", **kwargs ) -> "models.ApplicationDefinition": @@ -562,7 +563,9 @@ async def _create_or_update_by_id_initial( # Construct URL url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -575,7 +578,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ApplicationDefinition') body_content_kwargs['content'] = body_content @@ -589,7 +591,6 @@ async def _create_or_update_by_id_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ApplicationDefinition', pipeline_response) @@ -600,21 +601,21 @@ async def _create_or_update_by_id_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_by_id_initial.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + _create_or_update_by_id_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore async def begin_create_or_update_by_id( self, - application_definition_id: str, + resource_group_name: str, + application_definition_name: str, parameters: "models.ApplicationDefinition", **kwargs - ) -> "models.ApplicationDefinition": + ) -> AsyncLROPoller["models.ApplicationDefinition"]: """Creates a new managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :param parameters: Parameters supplied to the create or update a managed application definition. :type parameters: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition @@ -624,8 +625,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: ApplicationDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition + :return: An instance of AsyncLROPoller that returns either ApplicationDefinition or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.managedapplications.models.ApplicationDefinition] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -637,7 +638,8 @@ async def begin_create_or_update_by_id( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, parameters=parameters, cls=lambda x,y,z: x, **kwargs @@ -665,4 +667,4 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + begin_create_or_update_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_applications_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_applications_operations_async.py index 621d60bd61f6..d4cd2eb94727 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_applications_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations_async/_applications_operations_async.py @@ -48,7 +48,7 @@ async def get( resource_group_name: str, application_name: str, **kwargs - ) -> "models.Application": + ) -> Optional["models.Application"]: """Gets the managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,7 +60,7 @@ async def get( :rtype: ~azure.mgmt.resource.managedapplications.models.Application or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Application"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -82,7 +82,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -129,7 +128,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -149,7 +147,7 @@ async def begin_delete( resource_group_name: str, application_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes the managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -162,8 +160,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -233,7 +231,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Application') body_content_kwargs['content'] = body_content @@ -247,7 +244,6 @@ async def _create_or_update_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('Application', pipeline_response) @@ -266,7 +262,7 @@ async def begin_create_or_update( application_name: str, parameters: "models.Application", **kwargs - ) -> "models.Application": + ) -> AsyncLROPoller["models.Application"]: """Creates a new managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -281,8 +277,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Application, or the result of cls(response) - :rtype: ~azure.mgmt.resource.managedapplications.models.Application + :return: An instance of AsyncLROPoller that returns either Application or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.managedapplications.models.Application] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -329,9 +325,9 @@ async def update( self, resource_group_name: str, application_name: str, - parameters: Optional["models.Application"] = None, + parameters: Optional["models.ApplicationPatchable"] = None, **kwargs - ) -> "models.Application": + ) -> "models.ApplicationPatchable": """Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. @@ -340,13 +336,13 @@ async def update( :param application_name: The name of the managed application. :type application_name: str :param parameters: Parameters supplied to update an existing managed application. - :type parameters: ~azure.mgmt.resource.managedapplications.models.Application + :type parameters: ~azure.mgmt.resource.managedapplications.models.ApplicationPatchable :keyword callable cls: A custom type or function that will be passed the direct response - :return: Application, or the result of cls(response) - :rtype: ~azure.mgmt.resource.managedapplications.models.Application + :return: ApplicationPatchable, or the result of cls(response) + :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationPatchable :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationPatchable"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -370,10 +366,9 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'Application') + body_content = self._serialize.body(parameters, 'ApplicationPatchable') else: body_content = None body_content_kwargs['content'] = body_content @@ -387,7 +382,7 @@ async def update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Application', pipeline_response) + deserialized = self._deserialize('ApplicationPatchable', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -415,6 +410,10 @@ def list_by_resource_group( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -427,15 +426,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -480,6 +475,10 @@ def list_by_subscription( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -491,15 +490,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -531,7 +526,7 @@ async def get_by_id( self, application_id: str, **kwargs - ) -> "models.Application": + ) -> Optional["models.Application"]: """Gets the managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -544,7 +539,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.managedapplications.models.Application or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Application"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -564,7 +559,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -608,7 +602,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -627,7 +620,7 @@ async def begin_delete_by_id( self, application_id: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes the managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -641,8 +634,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -708,7 +701,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Application') body_content_kwargs['content'] = body_content @@ -722,7 +714,6 @@ async def _create_or_update_by_id_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('Application', pipeline_response) @@ -740,7 +731,7 @@ async def begin_create_or_update_by_id( application_id: str, parameters: "models.Application", **kwargs - ) -> "models.Application": + ) -> AsyncLROPoller["models.Application"]: """Creates a new managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -756,8 +747,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Application, or the result of cls(response) - :rtype: ~azure.mgmt.resource.managedapplications.models.Application + :return: An instance of AsyncLROPoller that returns either Application or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.managedapplications.models.Application] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -842,7 +833,6 @@ async def update_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: body_content = self._serialize.body(parameters, 'Application') diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py index b2c0a87c88db..d2be17a3e275 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py @@ -17,6 +17,9 @@ from ._models_py3 import ErrorResponse from ._models_py3 import GenericResource from ._models_py3 import Identity + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult from ._models_py3 import Plan from ._models_py3 import PlanPatchable from ._models_py3 import Resource @@ -32,6 +35,9 @@ from ._models import ErrorResponse # type: ignore from ._models import GenericResource # type: ignore from ._models import Identity # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore from ._models import Plan # type: ignore from ._models import PlanPatchable # type: ignore from ._models import Resource # type: ignore @@ -54,6 +60,9 @@ 'ErrorResponse', 'GenericResource', 'Identity', + 'Operation', + 'OperationDisplay', + 'OperationListResult', 'Plan', 'PlanPatchable', 'Resource', diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py index 0e8ea174e497..9a195f33c16b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py @@ -537,6 +537,79 @@ def __init__( self.tenant_id = None +class Operation(msrest.serialization.Model): + """Microsoft.Solutions operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.managedapplications.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Solutions. + :type provider: str + :param resource: Resource on which the operation is performed: Application, JitRequest, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Solutions operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Solutions operations. + :type value: list[~azure.mgmt.resource.managedapplications.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class Plan(msrest.serialization.Model): """Plan for the managed application. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py index 3c2d2df62ec6..f41bbfe488e7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py @@ -604,6 +604,89 @@ def __init__( self.tenant_id = None +class Operation(msrest.serialization.Model): + """Microsoft.Solutions operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.managedapplications.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Solutions. + :type provider: str + :param resource: Resource on which the operation is performed: Application, JitRequest, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Solutions operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Solutions operations. + :type value: list[~azure.mgmt.resource.managedapplications.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class Plan(msrest.serialization.Model): """Plan for the managed application. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py index cef7549ec472..76e2d17b2d58 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py @@ -6,10 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._application_client_operations import ApplicationClientOperationsMixin from ._applications_operations import ApplicationsOperations from ._application_definitions_operations import ApplicationDefinitionsOperations __all__ = [ + 'ApplicationClientOperationsMixin', 'ApplicationsOperations', 'ApplicationDefinitionsOperations', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_client_operations.py new file mode 100644 index 000000000000..ea79f283df39 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_client_operations.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationClientOperationsMixin(object): + + def list_operations( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationListResult"] + """Lists all of the available Microsoft.Solutions REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.managedapplications.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_operations.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Solutions/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py index b8c341909212..2010d4a4ff4b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py @@ -53,7 +53,7 @@ def get( application_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ApplicationDefinition" + # type: (...) -> Optional["models.ApplicationDefinition"] """Gets the managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,7 +65,7 @@ def get( :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ApplicationDefinition"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -87,7 +87,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -135,7 +134,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,7 +154,7 @@ def begin_delete( application_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes the managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -241,7 +239,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ApplicationDefinition') body_content_kwargs['content'] = body_content @@ -255,7 +252,6 @@ def _create_or_update_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ApplicationDefinition', pipeline_response) @@ -275,7 +271,7 @@ def begin_create_or_update( parameters, # type: "models.ApplicationDefinition" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.ApplicationDefinition"] """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -356,6 +352,10 @@ def list_by_resource_group( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -368,15 +368,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -406,23 +402,23 @@ def get_next(next_link=None): def get_by_id( self, - application_definition_id, # type: str + resource_group_name, # type: str + application_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ApplicationDefinition" + # type: (...) -> Optional["models.ApplicationDefinition"] """Gets the managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationDefinition, or the result of cls(response) :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ApplicationDefinition"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -430,7 +426,9 @@ def get_by_id( # Construct URL url = self.get_by_id.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -442,7 +440,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -460,11 +457,12 @@ def get_by_id( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore def _delete_by_id_initial( self, - application_definition_id, # type: str + resource_group_name, # type: str + application_definition_name, # type: str **kwargs # type: Any ): # type: (...) -> None @@ -476,7 +474,9 @@ def _delete_by_id_initial( # Construct URL url = self._delete_by_id_initial.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -487,7 +487,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,21 +499,21 @@ def _delete_by_id_initial( if cls: return cls(pipeline_response, None, {}) - _delete_by_id_initial.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + _delete_by_id_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore def begin_delete_by_id( self, - application_definition_id, # type: str + resource_group_name, # type: str + application_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes the managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a @@ -534,7 +533,8 @@ def begin_delete_by_id( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._delete_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, cls=lambda x,y,z: x, **kwargs ) @@ -558,11 +558,12 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + begin_delete_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore def _create_or_update_by_id_initial( self, - application_definition_id, # type: str + resource_group_name, # type: str + application_definition_name, # type: str parameters, # type: "models.ApplicationDefinition" **kwargs # type: Any ): @@ -576,7 +577,9 @@ def _create_or_update_by_id_initial( # Construct URL url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -589,7 +592,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ApplicationDefinition') body_content_kwargs['content'] = body_content @@ -603,7 +605,6 @@ def _create_or_update_by_id_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ApplicationDefinition', pipeline_response) @@ -614,22 +615,22 @@ def _create_or_update_by_id_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_by_id_initial.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + _create_or_update_by_id_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore def begin_create_or_update_by_id( self, - application_definition_id, # type: str + resource_group_name, # type: str + application_definition_name, # type: str parameters, # type: "models.ApplicationDefinition" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.ApplicationDefinition"] """Creates a new managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :param parameters: Parameters supplied to the create or update a managed application definition. :type parameters: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition @@ -652,7 +653,8 @@ def begin_create_or_update_by_id( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, parameters=parameters, cls=lambda x,y,z: x, **kwargs @@ -680,4 +682,4 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + begin_create_or_update_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py index c40791d974b0..d8025a71b976 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py @@ -53,7 +53,7 @@ def get( application_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Application" + # type: (...) -> Optional["models.Application"] """Gets the managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,7 +65,7 @@ def get( :rtype: ~azure.mgmt.resource.managedapplications.models.Application or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Application"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -87,7 +87,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -135,7 +134,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,7 +154,7 @@ def begin_delete( application_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes the managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -241,7 +239,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Application') body_content_kwargs['content'] = body_content @@ -255,7 +252,6 @@ def _create_or_update_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('Application', pipeline_response) @@ -275,7 +271,7 @@ def begin_create_or_update( parameters, # type: "models.Application" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Application"] """Creates a new managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -338,10 +334,10 @@ def update( self, resource_group_name, # type: str application_name, # type: str - parameters=None, # type: Optional["models.Application"] + parameters=None, # type: Optional["models.ApplicationPatchable"] **kwargs # type: Any ): - # type: (...) -> "models.Application" + # type: (...) -> "models.ApplicationPatchable" """Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. @@ -350,13 +346,13 @@ def update( :param application_name: The name of the managed application. :type application_name: str :param parameters: Parameters supplied to update an existing managed application. - :type parameters: ~azure.mgmt.resource.managedapplications.models.Application + :type parameters: ~azure.mgmt.resource.managedapplications.models.ApplicationPatchable :keyword callable cls: A custom type or function that will be passed the direct response - :return: Application, or the result of cls(response) - :rtype: ~azure.mgmt.resource.managedapplications.models.Application + :return: ApplicationPatchable, or the result of cls(response) + :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationPatchable :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationPatchable"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -380,10 +376,9 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'Application') + body_content = self._serialize.body(parameters, 'ApplicationPatchable') else: body_content = None body_content_kwargs['content'] = body_content @@ -397,7 +392,7 @@ def update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Application', pipeline_response) + deserialized = self._deserialize('ApplicationPatchable', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -426,6 +421,10 @@ def list_by_resource_group( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -438,15 +437,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -492,6 +487,10 @@ def list_by_subscription( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -503,15 +502,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -544,7 +539,7 @@ def get_by_id( application_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Application" + # type: (...) -> Optional["models.Application"] """Gets the managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -557,7 +552,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.managedapplications.models.Application or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Application"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01" @@ -577,7 +572,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -622,7 +616,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -642,7 +635,7 @@ def begin_delete_by_id( application_id, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes the managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -724,7 +717,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Application') body_content_kwargs['content'] = body_content @@ -738,7 +730,6 @@ def _create_or_update_by_id_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('Application', pipeline_response) @@ -757,7 +748,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.Application" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Application"] """Creates a new managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -860,7 +851,6 @@ def update_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: body_content = self._serialize.body(parameters, 'Application') diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations_async/_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations_async/_policy_assignments_operations_async.py index afb18d42de04..10aeea97d0a5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations_async/_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations_async/_policy_assignments_operations_async.py @@ -79,7 +79,6 @@ async def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -142,7 +141,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -201,7 +199,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,6 +238,10 @@ def list_for_resource_group( api_version = "2015-10-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -255,15 +256,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -326,6 +323,10 @@ def list_for_resource( api_version = "2015-10-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -344,15 +345,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -399,6 +396,10 @@ def list( api_version = "2015-10-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -412,15 +413,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -487,7 +484,6 @@ async def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -551,7 +547,6 @@ async def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -612,7 +607,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations_async/_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations_async/_policy_definitions_operations_async.py index 8cf1ef069993..bf8a355ba0eb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations_async/_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations_async/_policy_definitions_operations_async.py @@ -81,7 +81,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -136,7 +135,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,7 +183,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,6 +219,10 @@ def list( api_version = "2015-10-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -235,15 +236,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_assignments_operations.py index 55da29265705..2dca112a2167 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_assignments_operations.py @@ -84,7 +84,6 @@ def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -148,7 +147,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -208,7 +206,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,6 +246,10 @@ def list_for_resource_group( api_version = "2015-10-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -263,15 +264,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -335,6 +332,10 @@ def list_for_resource( api_version = "2015-10-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -353,15 +354,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -409,6 +406,10 @@ def list( api_version = "2015-10-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -422,15 +423,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -498,7 +495,6 @@ def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -563,7 +559,6 @@ def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -625,7 +620,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_definitions_operations.py index 3e9e9338b791..98828d70131c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_definitions_operations.py @@ -86,7 +86,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -142,7 +141,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +190,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,6 +227,10 @@ def list( api_version = "2015-10-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -243,15 +244,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations_async/_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations_async/_policy_assignments_operations_async.py index 71d9b04abd8d..de2a05182e1d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations_async/_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations_async/_policy_assignments_operations_async.py @@ -79,7 +79,6 @@ async def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -142,7 +141,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -201,7 +199,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,6 +238,10 @@ def list_for_resource_group( api_version = "2016-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -255,15 +256,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -326,6 +323,10 @@ def list_for_resource( api_version = "2016-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -344,15 +345,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -399,6 +396,10 @@ def list( api_version = "2016-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -412,15 +413,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -487,7 +484,6 @@ async def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -551,7 +547,6 @@ async def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -612,7 +607,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations_async/_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations_async/_policy_definitions_operations_async.py index e44d18a87767..531e7d5066ef 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations_async/_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations_async/_policy_definitions_operations_async.py @@ -81,7 +81,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -136,7 +135,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,7 +183,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,6 +219,10 @@ def list( api_version = "2016-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -235,15 +236,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_assignments_operations.py index 78858c413d42..e11fb5c8a8d3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_assignments_operations.py @@ -84,7 +84,6 @@ def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -148,7 +147,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -208,7 +206,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,6 +246,10 @@ def list_for_resource_group( api_version = "2016-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -263,15 +264,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -335,6 +332,10 @@ def list_for_resource( api_version = "2016-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -353,15 +354,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -409,6 +406,10 @@ def list( api_version = "2016-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -422,15 +423,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -498,7 +495,6 @@ def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -563,7 +559,6 @@ def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -625,7 +620,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_definitions_operations.py index 67404296288b..8c9e063a4480 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_definitions_operations.py @@ -86,7 +86,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -142,7 +141,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +190,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,6 +227,10 @@ def list( api_version = "2016-04-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -243,15 +244,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations_async/_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations_async/_policy_assignments_operations_async.py index 544cd50119c3..6e9bd3cbab82 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations_async/_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations_async/_policy_assignments_operations_async.py @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -58,7 +58,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-12-01" @@ -79,7 +79,6 @@ async def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -144,7 +143,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -203,7 +201,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,6 +240,10 @@ def list_for_resource_group( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -257,15 +258,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -328,6 +325,10 @@ def list_for_resource( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -346,15 +347,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -401,6 +398,10 @@ def list( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -414,15 +415,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -489,7 +486,6 @@ async def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -553,7 +549,6 @@ async def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -614,7 +609,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations_async/_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations_async/_policy_definitions_operations_async.py index 1a2278a414a0..975b8383c942 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations_async/_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations_async/_policy_definitions_operations_async.py @@ -81,7 +81,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -136,7 +135,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,7 +183,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,7 +233,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,7 +292,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -354,7 +349,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -406,7 +400,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -440,6 +433,10 @@ def list( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -451,15 +448,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -503,6 +496,10 @@ def list_built_in( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -510,15 +507,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -565,6 +558,10 @@ def list_by_management_group( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -576,15 +573,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py index 1d2b922385a7..b4c35dfd545b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -63,7 +63,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-12-01" @@ -84,7 +84,6 @@ def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -150,7 +149,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -210,7 +208,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,6 +248,10 @@ def list_for_resource_group( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -265,15 +266,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -337,6 +334,10 @@ def list_for_resource( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -355,15 +356,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -411,6 +408,10 @@ def list( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -424,15 +425,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -500,7 +497,6 @@ def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -565,7 +561,6 @@ def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -627,7 +622,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_definitions_operations.py index b894c0d15328..a0c0d0691816 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_definitions_operations.py @@ -86,7 +86,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -142,7 +141,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +190,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,7 +241,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -305,7 +301,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -364,7 +359,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,7 +411,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -452,6 +445,10 @@ def list( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -463,15 +460,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -516,6 +509,10 @@ def list_built_in( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -523,15 +520,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -579,6 +572,10 @@ def list_by_management_group( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -590,15 +587,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_assignments_operations_async.py index c357b6a05b70..d130ff996857 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_assignments_operations_async.py @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -58,7 +58,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-06-01-preview" @@ -79,7 +79,6 @@ async def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -145,7 +144,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -205,7 +203,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,6 +243,10 @@ def list_for_resource_group( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -260,15 +261,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -332,6 +329,10 @@ def list_for_resource( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -350,15 +351,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -406,6 +403,10 @@ def list( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -419,15 +420,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -495,7 +492,6 @@ async def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -560,7 +556,6 @@ async def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -622,7 +617,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_definitions_operations_async.py index 1609828c5912..37b02e5522c3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_definitions_operations_async.py @@ -81,7 +81,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -136,7 +135,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,7 +183,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,7 +233,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,7 +292,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -354,7 +349,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -406,7 +400,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -440,6 +433,10 @@ def list( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -451,15 +448,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -503,6 +496,10 @@ def list_built_in( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -510,15 +507,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -565,6 +558,10 @@ def list_by_management_group( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -576,15 +573,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_set_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_set_definitions_operations_async.py index 5f7e845384e2..34b215b3ec4e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_set_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations_async/_policy_set_definitions_operations_async.py @@ -81,7 +81,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -95,7 +94,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -142,7 +140,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +189,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,7 +240,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -279,6 +274,10 @@ def list( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -290,15 +289,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -343,6 +338,10 @@ def list_built_in( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -350,15 +349,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -429,7 +424,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -443,7 +437,6 @@ async def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -493,7 +486,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -546,7 +538,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -584,6 +575,10 @@ def list_by_management_group( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -595,15 +590,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_assignments_operations.py index 7e88b3799bdb..7839c45eb905 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_assignments_operations.py @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -63,7 +63,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-06-01-preview" @@ -84,7 +84,6 @@ def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -151,7 +150,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -212,7 +210,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,6 +251,10 @@ def list_for_resource_group( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -268,15 +269,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -341,6 +338,10 @@ def list_for_resource( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -359,15 +360,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -416,6 +413,10 @@ def list( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -429,15 +430,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -506,7 +503,6 @@ def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -572,7 +568,6 @@ def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -635,7 +630,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_definitions_operations.py index 582a5132a634..779a8ce32c23 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_definitions_operations.py @@ -86,7 +86,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -142,7 +141,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +190,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,7 +241,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -305,7 +301,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -364,7 +359,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,7 +411,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -452,6 +445,10 @@ def list( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -463,15 +460,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -516,6 +509,10 @@ def list_built_in( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -523,15 +520,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -579,6 +572,10 @@ def list_by_management_group( api_version = "2016-12-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -590,15 +587,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_set_definitions_operations.py index 7a325c9e838c..8fc67f063214 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_set_definitions_operations.py @@ -86,7 +86,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -100,7 +99,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -148,7 +146,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,7 +196,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -252,7 +248,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -288,6 +283,10 @@ def list( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -299,15 +298,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -353,6 +348,10 @@ def list_built_in( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -360,15 +359,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -440,7 +435,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -454,7 +448,6 @@ def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -505,7 +498,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -559,7 +551,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -598,6 +589,10 @@ def list_by_management_group( api_version = "2017-06-01-preview" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -609,15 +604,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_assignments_operations_async.py index 78d00c669b16..eff665a03ea2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_assignments_operations_async.py @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-03-01" @@ -87,7 +87,6 @@ async def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -158,7 +157,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -225,7 +223,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,6 +275,10 @@ def list_for_resource_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -292,15 +293,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -389,6 +386,10 @@ def list_for_resource( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -407,15 +408,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -475,6 +472,10 @@ def list( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -488,15 +489,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -528,7 +525,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -547,7 +544,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-03-01" @@ -567,7 +564,6 @@ async def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -638,7 +634,6 @@ async def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -704,7 +699,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_definitions_operations_async.py index 1fdeacfeffe6..8e475de7861c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -141,7 +140,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +190,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,7 +242,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,7 +304,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -368,7 +363,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,7 +417,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -459,6 +452,10 @@ def list( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -470,15 +467,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -524,6 +517,10 @@ def list_built_in( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -531,15 +528,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -588,6 +581,10 @@ def list_by_management_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -599,15 +596,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_set_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_set_definitions_operations_async.py index d304fd62218a..94e54be59d89 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_set_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations_async/_policy_set_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -98,7 +97,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -147,7 +145,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -200,7 +197,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,7 +250,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +286,10 @@ def list( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +301,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -357,6 +352,10 @@ def list_built_in( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -364,15 +363,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -446,7 +441,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -460,7 +454,6 @@ async def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -513,7 +506,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -569,7 +561,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -610,6 +601,10 @@ def list_by_management_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -621,15 +616,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_assignments_operations.py index e3385c9001fd..1290742b2dcc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_assignments_operations.py @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-03-01" @@ -92,7 +92,6 @@ def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -164,7 +163,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -232,7 +230,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +283,10 @@ def list_for_resource_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -300,15 +301,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -398,6 +395,10 @@ def list_for_resource( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -416,15 +417,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -485,6 +482,10 @@ def list( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -498,15 +499,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -539,7 +536,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -558,7 +555,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-03-01" @@ -578,7 +575,6 @@ def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -650,7 +646,6 @@ def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -717,7 +712,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_definitions_operations.py index abae03ae9a80..3267468fdbdf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -147,7 +146,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,7 +197,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,7 +250,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -317,7 +313,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -378,7 +373,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,7 +428,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -471,6 +464,10 @@ def list( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -482,15 +479,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -537,6 +530,10 @@ def list_built_in( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -544,15 +541,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -602,6 +595,10 @@ def list_by_management_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -613,15 +610,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_set_definitions_operations.py index 1798619e0b67..0b8236fc6475 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_set_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -103,7 +102,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -153,7 +151,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -207,7 +204,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,7 +258,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,6 +295,10 @@ def list( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -311,15 +310,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -367,6 +362,10 @@ def list_built_in( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -374,15 +373,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -457,7 +452,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -471,7 +465,6 @@ def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -525,7 +518,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -582,7 +574,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -624,6 +615,10 @@ def list_by_management_group( api_version = "2018-03-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -635,15 +630,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_assignments_operations_async.py index a5e38f386762..5cca788acddc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_assignments_operations_async.py @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -87,7 +87,6 @@ async def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -158,7 +157,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -225,7 +223,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,6 +275,10 @@ def list_for_resource_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -292,15 +293,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -389,6 +386,10 @@ def list_for_resource( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -407,15 +408,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -475,6 +472,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -488,15 +489,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -528,7 +525,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -547,7 +544,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -567,7 +564,6 @@ async def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -638,7 +634,6 @@ async def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -704,7 +699,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_definitions_operations_async.py index e2bfe901c43d..3fb27f07afbb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -141,7 +140,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +190,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,7 +242,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,7 +304,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -368,7 +363,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,7 +417,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -459,6 +452,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -470,15 +467,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -524,6 +517,10 @@ def list_built_in( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -531,15 +528,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -588,6 +581,10 @@ def list_by_management_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -599,15 +596,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_set_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_set_definitions_operations_async.py index 8c65d9fd15fb..741e020e56b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_set_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations_async/_policy_set_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -98,7 +97,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -147,7 +145,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -200,7 +197,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,7 +250,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +286,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +301,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -357,6 +352,10 @@ def list_built_in( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -364,15 +363,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -446,7 +441,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -460,7 +454,6 @@ async def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -513,7 +506,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -569,7 +561,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -610,6 +601,10 @@ def list_by_management_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -621,15 +616,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_assignments_operations.py index 84176c204f44..ccdbd8ad4b02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_assignments_operations.py @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -92,7 +92,6 @@ def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -164,7 +163,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -232,7 +230,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +283,10 @@ def list_for_resource_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -300,15 +301,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -398,6 +395,10 @@ def list_for_resource( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -416,15 +417,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -485,6 +482,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -498,15 +499,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -539,7 +536,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -558,7 +555,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -578,7 +575,6 @@ def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -650,7 +646,6 @@ def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -717,7 +712,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_definitions_operations.py index 1dc520a785af..9ec1429d3dbf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -147,7 +146,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,7 +197,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,7 +250,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -317,7 +313,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -378,7 +373,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,7 +428,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -471,6 +464,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -482,15 +479,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -537,6 +530,10 @@ def list_built_in( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -544,15 +541,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -602,6 +595,10 @@ def list_by_management_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -613,15 +610,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_set_definitions_operations.py index 0cb63221239e..c61c5570434e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_set_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -103,7 +102,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -153,7 +151,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -207,7 +204,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,7 +258,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,6 +295,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -311,15 +310,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -367,6 +362,10 @@ def list_built_in( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -374,15 +373,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -457,7 +452,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -471,7 +465,6 @@ def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -525,7 +518,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -582,7 +574,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -624,6 +615,10 @@ def list_by_management_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -635,15 +630,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_assignments_operations_async.py index 3c04d7c2d008..ccd6af136c03 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_assignments_operations_async.py @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-01-01" @@ -87,7 +87,6 @@ async def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -158,7 +157,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -225,7 +223,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,6 +275,10 @@ def list_for_resource_group( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -292,15 +293,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -389,6 +386,10 @@ def list_for_resource( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -407,15 +408,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -475,6 +472,10 @@ def list( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -488,15 +489,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -528,7 +525,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -547,7 +544,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-01-01" @@ -567,7 +564,6 @@ async def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -638,7 +634,6 @@ async def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -704,7 +699,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_definitions_operations_async.py index 7401ee421904..6a6d20ca2503 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -141,7 +140,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +190,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,7 +242,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,7 +304,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -368,7 +363,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,7 +417,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -459,6 +452,10 @@ def list( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -470,15 +467,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -524,6 +517,10 @@ def list_built_in( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -531,15 +528,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -588,6 +581,10 @@ def list_by_management_group( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -599,15 +596,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_set_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_set_definitions_operations_async.py index fa9c3218b6ff..68a2b8aef3bc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_set_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations_async/_policy_set_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -98,7 +97,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -147,7 +145,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -200,7 +197,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,7 +250,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +286,10 @@ def list( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +301,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -357,6 +352,10 @@ def list_built_in( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -364,15 +363,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -446,7 +441,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -460,7 +454,6 @@ async def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -513,7 +506,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -569,7 +561,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -610,6 +601,10 @@ def list_by_management_group( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -621,15 +616,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_assignments_operations.py index f5544a0ead54..f732ffedcae8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_assignments_operations.py @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-01-01" @@ -92,7 +92,6 @@ def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -164,7 +163,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -232,7 +230,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +283,10 @@ def list_for_resource_group( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -300,15 +301,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -398,6 +395,10 @@ def list_for_resource( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -416,15 +417,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -485,6 +482,10 @@ def list( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -498,15 +499,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -539,7 +536,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -558,7 +555,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-01-01" @@ -578,7 +575,6 @@ def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -650,7 +646,6 @@ def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -717,7 +712,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_definitions_operations.py index ed0bcba7f126..75f2fbb48433 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -147,7 +146,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,7 +197,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,7 +250,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -317,7 +313,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -378,7 +373,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,7 +428,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -471,6 +464,10 @@ def list( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -482,15 +479,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -537,6 +530,10 @@ def list_built_in( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -544,15 +541,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -602,6 +595,10 @@ def list_by_management_group( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -613,15 +610,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_set_definitions_operations.py index 298230988973..284df5a9a6d3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_set_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -103,7 +102,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -153,7 +151,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -207,7 +204,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,7 +258,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,6 +295,10 @@ def list( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -311,15 +310,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -367,6 +362,10 @@ def list_built_in( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -374,15 +373,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -457,7 +452,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -471,7 +465,6 @@ def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -525,7 +518,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -582,7 +574,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -624,6 +615,10 @@ def list_by_management_group( api_version = "2019-01-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -635,15 +630,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_assignments_operations_async.py index 32921413eeaa..a77ca15e993f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_assignments_operations_async.py @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-06-01" @@ -87,7 +87,6 @@ async def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -158,7 +157,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -225,7 +223,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,6 +275,10 @@ def list_for_resource_group( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -292,15 +293,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -389,6 +386,10 @@ def list_for_resource( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -407,15 +408,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -475,6 +472,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -488,15 +489,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -528,7 +525,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -547,7 +544,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-06-01" @@ -567,7 +564,6 @@ async def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -638,7 +634,6 @@ async def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -704,7 +699,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_definitions_operations_async.py index ca89a930ae8e..f4588cd7e20f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -141,7 +140,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +190,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,7 +242,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,7 +304,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -368,7 +363,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,7 +417,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -459,6 +452,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -470,15 +467,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -524,6 +517,10 @@ def list_built_in( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -531,15 +528,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -588,6 +581,10 @@ def list_by_management_group( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -599,15 +596,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_set_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_set_definitions_operations_async.py index f2e06368db4e..d6c12378f100 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_set_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations_async/_policy_set_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -98,7 +97,6 @@ async def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -147,7 +145,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -200,7 +197,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,7 +250,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +286,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +301,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -357,6 +352,10 @@ def list_built_in( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -364,15 +363,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -446,7 +441,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -460,7 +454,6 @@ async def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -513,7 +506,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -569,7 +561,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -610,6 +601,10 @@ def list_by_management_group( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -621,15 +616,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_assignments_operations.py index f510a2cc6ac9..fd2a3e3bf759 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_assignments_operations.py @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-06-01" @@ -92,7 +92,6 @@ def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -164,7 +163,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -232,7 +230,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +283,10 @@ def list_for_resource_group( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -300,15 +301,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -398,6 +395,10 @@ def list_for_resource( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -416,15 +417,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -485,6 +482,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -498,15 +499,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -539,7 +536,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -558,7 +555,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-06-01" @@ -578,7 +575,6 @@ def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -650,7 +646,6 @@ def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -717,7 +712,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_definitions_operations.py index 47c8bc1047d9..c4adbf0cac45 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -147,7 +146,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,7 +197,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,7 +250,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -317,7 +313,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -378,7 +373,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,7 +428,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -471,6 +464,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -482,15 +479,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -537,6 +530,10 @@ def list_built_in( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -544,15 +541,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -602,6 +595,10 @@ def list_by_management_group( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -613,15 +610,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_set_definitions_operations.py index f293e0d71c6a..3748626d12b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_set_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -103,7 +102,6 @@ def create_or_update( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -153,7 +151,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -207,7 +204,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,7 +258,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,6 +295,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -311,15 +310,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -367,6 +362,10 @@ def list_built_in( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -374,15 +373,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -457,7 +452,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -471,7 +465,6 @@ def create_or_update_at_management_group( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -525,7 +518,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -582,7 +574,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -624,6 +615,10 @@ def list_by_management_group( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -635,15 +630,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_assignments_operations_async.py index 49e0c5cf328c..e9d826c7614c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_assignments_operations_async.py @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" @@ -87,7 +87,6 @@ async def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -157,7 +156,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -223,7 +221,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -275,6 +272,10 @@ def list_for_resource_group( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -289,15 +290,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -385,6 +382,10 @@ def list_for_resource( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -403,15 +404,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -470,6 +467,10 @@ def list_for_management_group( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_management_group.metadata['url'] # type: ignore @@ -482,15 +483,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -549,6 +546,10 @@ def list( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -562,15 +563,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -601,7 +598,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> Optional["models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -620,7 +617,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" @@ -640,7 +637,6 @@ async def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -710,7 +706,6 @@ async def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -775,7 +770,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_definitions_operations_async.py index ec19e7a38277..6d1a270b324f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -141,7 +140,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,7 +190,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,7 +242,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,7 +304,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -368,7 +363,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,7 +417,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -459,6 +452,10 @@ def list( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -470,15 +467,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -524,6 +517,10 @@ def list_built_in( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -531,15 +528,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -588,6 +581,10 @@ def list_by_management_group( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -599,15 +596,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_set_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_set_definitions_operations_async.py index e1ddc3150ea9..2a23fd32a6de 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_set_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations_async/_policy_set_definitions_operations_async.py @@ -84,7 +84,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -97,7 +96,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -146,7 +144,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -198,7 +195,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,7 +247,6 @@ async def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,6 +282,10 @@ def list( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -298,15 +297,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -352,6 +347,10 @@ def list_built_in( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -359,15 +358,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -440,7 +435,6 @@ async def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -453,7 +447,6 @@ async def create_or_update_at_management_group( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -506,7 +499,6 @@ async def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -561,7 +553,6 @@ async def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -601,6 +592,10 @@ def list_by_management_group( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -612,15 +607,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_assignments_operations.py index b72c1a1b1ece..9b9931d3c88c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_assignments_operations.py @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" @@ -92,7 +92,6 @@ def delete( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,7 +162,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -230,7 +228,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -283,6 +280,10 @@ def list_for_resource_group( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] # type: ignore @@ -297,15 +298,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -394,6 +391,10 @@ def list_for_resource( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] # type: ignore @@ -412,15 +413,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -480,6 +477,10 @@ def list_for_management_group( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_for_management_group.metadata['url'] # type: ignore @@ -492,15 +493,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -560,6 +557,10 @@ def list( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -573,15 +574,11 @@ def prepare_request(next_link=None): query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -613,7 +610,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> Optional["models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -632,7 +629,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" @@ -652,7 +649,6 @@ def delete_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -723,7 +719,6 @@ def create_by_id( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyAssignment') body_content_kwargs['content'] = body_content @@ -789,7 +784,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_definitions_operations.py index 99129c289a19..479e440b1da1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -147,7 +146,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,7 +197,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,7 +250,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -317,7 +313,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicyDefinition') body_content_kwargs['content'] = body_content @@ -378,7 +373,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,7 +428,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -471,6 +464,10 @@ def list( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -482,15 +479,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -537,6 +530,10 @@ def list_built_in( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -544,15 +541,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -602,6 +595,10 @@ def list_by_management_group( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -613,15 +610,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_set_definitions_operations.py index beabf3cfd581..5d4beb7be373 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_set_definitions_operations.py @@ -89,7 +89,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -102,7 +101,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -152,7 +150,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -205,7 +202,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -259,7 +255,6 @@ def get_built_in( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,6 +291,10 @@ def list( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -307,15 +306,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -362,6 +357,10 @@ def list_built_in( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_built_in.metadata['url'] # type: ignore @@ -369,15 +368,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -451,7 +446,6 @@ def create_or_update_at_management_group( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'PolicySetDefinition') body_content_kwargs['content'] = body_content @@ -464,7 +458,6 @@ def create_or_update_at_management_group( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -518,7 +511,6 @@ def delete_at_management_group( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -574,7 +566,6 @@ def get_at_management_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -615,6 +606,10 @@ def list_by_management_group( api_version = "2019-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_management_group.metadata['url'] # type: ignore @@ -626,15 +621,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py index 89b862dfe86e..001ba75d79bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py @@ -46,7 +46,7 @@ class ResourceManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2019-10-01' + DEFAULT_API_VERSION = '2020-06-01' _PROFILE_TAG = "azure.mgmt.resource.ResourceManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -88,11 +88,13 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2017-05-10: :mod:`v2017_05_10.models` * 2018-02-01: :mod:`v2018_02_01.models` * 2018-05-01: :mod:`v2018_05_01.models` + * 2019-03-01: :mod:`v2019_03_01.models` * 2019-05-01: :mod:`v2019_05_01.models` * 2019-05-10: :mod:`v2019_05_10.models` * 2019-07-01: :mod:`v2019_07_01.models` * 2019-08-01: :mod:`v2019_08_01.models` * 2019-10-01: :mod:`v2019_10_01.models` + * 2020-06-01: :mod:`v2020_06_01.models` """ if api_version == '2016-02-01': from .v2016_02_01 import models @@ -109,6 +111,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2018-05-01': from .v2018_05_01 import models return models + elif api_version == '2019-03-01': + from .v2019_03_01 import models + return models elif api_version == '2019-05-01': from .v2019_05_01 import models return models @@ -124,6 +129,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-10-01': from .v2019_10_01 import models return models + elif api_version == '2020-06-01': + from .v2020_06_01 import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property @@ -135,11 +143,13 @@ def deployment_operations(self): * 2017-05-10: :class:`DeploymentOperationsOperations` * 2018-02-01: :class:`DeploymentOperationsOperations` * 2018-05-01: :class:`DeploymentOperationsOperations` + * 2019-03-01: :class:`DeploymentOperationsOperations` * 2019-05-01: :class:`DeploymentOperationsOperations` * 2019-05-10: :class:`DeploymentOperationsOperations` * 2019-07-01: :class:`DeploymentOperationsOperations` * 2019-08-01: :class:`DeploymentOperationsOperations` * 2019-10-01: :class:`DeploymentOperationsOperations` + * 2020-06-01: :class:`DeploymentOperationsOperations` """ api_version = self._get_api_version('deployment_operations') if api_version == '2016-02-01': @@ -152,6 +162,8 @@ def deployment_operations(self): from .v2018_02_01.operations import DeploymentOperationsOperations as OperationClass elif api_version == '2018-05-01': from .v2018_05_01.operations import DeploymentOperationsOperations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import DeploymentOperationsOperations as OperationClass elif api_version == '2019-05-01': from .v2019_05_01.operations import DeploymentOperationsOperations as OperationClass elif api_version == '2019-05-10': @@ -162,6 +174,8 @@ def deployment_operations(self): from .v2019_08_01.operations import DeploymentOperationsOperations as OperationClass elif api_version == '2019-10-01': from .v2019_10_01.operations import DeploymentOperationsOperations as OperationClass + elif api_version == '2020-06-01': + from .v2020_06_01.operations import DeploymentOperationsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -175,11 +189,13 @@ def deployments(self): * 2017-05-10: :class:`DeploymentsOperations` * 2018-02-01: :class:`DeploymentsOperations` * 2018-05-01: :class:`DeploymentsOperations` + * 2019-03-01: :class:`DeploymentsOperations` * 2019-05-01: :class:`DeploymentsOperations` * 2019-05-10: :class:`DeploymentsOperations` * 2019-07-01: :class:`DeploymentsOperations` * 2019-08-01: :class:`DeploymentsOperations` * 2019-10-01: :class:`DeploymentsOperations` + * 2020-06-01: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2016-02-01': @@ -192,6 +208,8 @@ def deployments(self): from .v2018_02_01.operations import DeploymentsOperations as OperationClass elif api_version == '2018-05-01': from .v2018_05_01.operations import DeploymentsOperations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import DeploymentsOperations as OperationClass elif api_version == '2019-05-01': from .v2019_05_01.operations import DeploymentsOperations as OperationClass elif api_version == '2019-05-10': @@ -202,6 +220,8 @@ def deployments(self): from .v2019_08_01.operations import DeploymentsOperations as OperationClass elif api_version == '2019-10-01': from .v2019_10_01.operations import DeploymentsOperations as OperationClass + elif api_version == '2020-06-01': + from .v2020_06_01.operations import DeploymentsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -211,15 +231,19 @@ def operations(self): """Instance depends on the API version: * 2018-05-01: :class:`Operations` + * 2019-03-01: :class:`Operations` * 2019-05-01: :class:`Operations` * 2019-05-10: :class:`Operations` * 2019-07-01: :class:`Operations` * 2019-08-01: :class:`Operations` * 2019-10-01: :class:`Operations` + * 2020-06-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-05-01': from .v2018_05_01.operations import Operations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import Operations as OperationClass elif api_version == '2019-05-01': from .v2019_05_01.operations import Operations as OperationClass elif api_version == '2019-05-10': @@ -230,6 +254,8 @@ def operations(self): from .v2019_08_01.operations import Operations as OperationClass elif api_version == '2019-10-01': from .v2019_10_01.operations import Operations as OperationClass + elif api_version == '2020-06-01': + from .v2020_06_01.operations import Operations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -243,11 +269,13 @@ def providers(self): * 2017-05-10: :class:`ProvidersOperations` * 2018-02-01: :class:`ProvidersOperations` * 2018-05-01: :class:`ProvidersOperations` + * 2019-03-01: :class:`ProvidersOperations` * 2019-05-01: :class:`ProvidersOperations` * 2019-05-10: :class:`ProvidersOperations` * 2019-07-01: :class:`ProvidersOperations` * 2019-08-01: :class:`ProvidersOperations` * 2019-10-01: :class:`ProvidersOperations` + * 2020-06-01: :class:`ProvidersOperations` """ api_version = self._get_api_version('providers') if api_version == '2016-02-01': @@ -260,6 +288,8 @@ def providers(self): from .v2018_02_01.operations import ProvidersOperations as OperationClass elif api_version == '2018-05-01': from .v2018_05_01.operations import ProvidersOperations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import ProvidersOperations as OperationClass elif api_version == '2019-05-01': from .v2019_05_01.operations import ProvidersOperations as OperationClass elif api_version == '2019-05-10': @@ -270,6 +300,8 @@ def providers(self): from .v2019_08_01.operations import ProvidersOperations as OperationClass elif api_version == '2019-10-01': from .v2019_10_01.operations import ProvidersOperations as OperationClass + elif api_version == '2020-06-01': + from .v2020_06_01.operations import ProvidersOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -283,11 +315,13 @@ def resource_groups(self): * 2017-05-10: :class:`ResourceGroupsOperations` * 2018-02-01: :class:`ResourceGroupsOperations` * 2018-05-01: :class:`ResourceGroupsOperations` + * 2019-03-01: :class:`ResourceGroupsOperations` * 2019-05-01: :class:`ResourceGroupsOperations` * 2019-05-10: :class:`ResourceGroupsOperations` * 2019-07-01: :class:`ResourceGroupsOperations` * 2019-08-01: :class:`ResourceGroupsOperations` * 2019-10-01: :class:`ResourceGroupsOperations` + * 2020-06-01: :class:`ResourceGroupsOperations` """ api_version = self._get_api_version('resource_groups') if api_version == '2016-02-01': @@ -300,6 +334,8 @@ def resource_groups(self): from .v2018_02_01.operations import ResourceGroupsOperations as OperationClass elif api_version == '2018-05-01': from .v2018_05_01.operations import ResourceGroupsOperations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import ResourceGroupsOperations as OperationClass elif api_version == '2019-05-01': from .v2019_05_01.operations import ResourceGroupsOperations as OperationClass elif api_version == '2019-05-10': @@ -310,6 +346,8 @@ def resource_groups(self): from .v2019_08_01.operations import ResourceGroupsOperations as OperationClass elif api_version == '2019-10-01': from .v2019_10_01.operations import ResourceGroupsOperations as OperationClass + elif api_version == '2020-06-01': + from .v2020_06_01.operations import ResourceGroupsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -323,11 +361,13 @@ def resources(self): * 2017-05-10: :class:`ResourcesOperations` * 2018-02-01: :class:`ResourcesOperations` * 2018-05-01: :class:`ResourcesOperations` + * 2019-03-01: :class:`ResourcesOperations` * 2019-05-01: :class:`ResourcesOperations` * 2019-05-10: :class:`ResourcesOperations` * 2019-07-01: :class:`ResourcesOperations` * 2019-08-01: :class:`ResourcesOperations` * 2019-10-01: :class:`ResourcesOperations` + * 2020-06-01: :class:`ResourcesOperations` """ api_version = self._get_api_version('resources') if api_version == '2016-02-01': @@ -340,6 +380,8 @@ def resources(self): from .v2018_02_01.operations import ResourcesOperations as OperationClass elif api_version == '2018-05-01': from .v2018_05_01.operations import ResourcesOperations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import ResourcesOperations as OperationClass elif api_version == '2019-05-01': from .v2019_05_01.operations import ResourcesOperations as OperationClass elif api_version == '2019-05-10': @@ -350,6 +392,8 @@ def resources(self): from .v2019_08_01.operations import ResourcesOperations as OperationClass elif api_version == '2019-10-01': from .v2019_10_01.operations import ResourcesOperations as OperationClass + elif api_version == '2020-06-01': + from .v2020_06_01.operations import ResourcesOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -363,11 +407,13 @@ def tags(self): * 2017-05-10: :class:`TagsOperations` * 2018-02-01: :class:`TagsOperations` * 2018-05-01: :class:`TagsOperations` + * 2019-03-01: :class:`TagsOperations` * 2019-05-01: :class:`TagsOperations` * 2019-05-10: :class:`TagsOperations` * 2019-07-01: :class:`TagsOperations` * 2019-08-01: :class:`TagsOperations` * 2019-10-01: :class:`TagsOperations` + * 2020-06-01: :class:`TagsOperations` """ api_version = self._get_api_version('tags') if api_version == '2016-02-01': @@ -380,6 +426,8 @@ def tags(self): from .v2018_02_01.operations import TagsOperations as OperationClass elif api_version == '2018-05-01': from .v2018_05_01.operations import TagsOperations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import TagsOperations as OperationClass elif api_version == '2019-05-01': from .v2019_05_01.operations import TagsOperations as OperationClass elif api_version == '2019-05-10': @@ -390,6 +438,8 @@ def tags(self): from .v2019_08_01.operations import TagsOperations as OperationClass elif api_version == '2019-10-01': from .v2019_10_01.operations import TagsOperations as OperationClass + elif api_version == '2020-06-01': + from .v2020_06_01.operations import TagsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client_async.py index 403b0d3734d6..153955d5065c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client_async.py @@ -46,7 +46,7 @@ class ResourceManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2019-10-01' + DEFAULT_API_VERSION = '2020-06-01' _PROFILE_TAG = "azure.mgmt.resource.ResourceManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -88,11 +88,13 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2017-05-10: :mod:`v2017_05_10.models` * 2018-02-01: :mod:`v2018_02_01.models` * 2018-05-01: :mod:`v2018_05_01.models` + * 2019-03-01: :mod:`v2019_03_01.models` * 2019-05-01: :mod:`v2019_05_01.models` * 2019-05-10: :mod:`v2019_05_10.models` * 2019-07-01: :mod:`v2019_07_01.models` * 2019-08-01: :mod:`v2019_08_01.models` * 2019-10-01: :mod:`v2019_10_01.models` + * 2020-06-01: :mod:`v2020_06_01.models` """ if api_version == '2016-02-01': from ..v2016_02_01 import models @@ -109,6 +111,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2018-05-01': from ..v2018_05_01 import models return models + elif api_version == '2019-03-01': + from ..v2019_03_01 import models + return models elif api_version == '2019-05-01': from ..v2019_05_01 import models return models @@ -124,6 +129,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-10-01': from ..v2019_10_01 import models return models + elif api_version == '2020-06-01': + from ..v2020_06_01 import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property @@ -135,11 +143,13 @@ def deployment_operations(self): * 2017-05-10: :class:`DeploymentOperationsOperations` * 2018-02-01: :class:`DeploymentOperationsOperations` * 2018-05-01: :class:`DeploymentOperationsOperations` + * 2019-03-01: :class:`DeploymentOperationsOperations` * 2019-05-01: :class:`DeploymentOperationsOperations` * 2019-05-10: :class:`DeploymentOperationsOperations` * 2019-07-01: :class:`DeploymentOperationsOperations` * 2019-08-01: :class:`DeploymentOperationsOperations` * 2019-10-01: :class:`DeploymentOperationsOperations` + * 2020-06-01: :class:`DeploymentOperationsOperations` """ api_version = self._get_api_version('deployment_operations') if api_version == '2016-02-01': @@ -152,6 +162,8 @@ def deployment_operations(self): from ..v2018_02_01.aio.operations_async import DeploymentOperationsOperations as OperationClass elif api_version == '2018-05-01': from ..v2018_05_01.aio.operations_async import DeploymentOperationsOperations as OperationClass + elif api_version == '2019-03-01': + from ..v2019_03_01.aio.operations_async import DeploymentOperationsOperations as OperationClass elif api_version == '2019-05-01': from ..v2019_05_01.aio.operations_async import DeploymentOperationsOperations as OperationClass elif api_version == '2019-05-10': @@ -162,6 +174,8 @@ def deployment_operations(self): from ..v2019_08_01.aio.operations_async import DeploymentOperationsOperations as OperationClass elif api_version == '2019-10-01': from ..v2019_10_01.aio.operations_async import DeploymentOperationsOperations as OperationClass + elif api_version == '2020-06-01': + from ..v2020_06_01.aio.operations_async import DeploymentOperationsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -175,11 +189,13 @@ def deployments(self): * 2017-05-10: :class:`DeploymentsOperations` * 2018-02-01: :class:`DeploymentsOperations` * 2018-05-01: :class:`DeploymentsOperations` + * 2019-03-01: :class:`DeploymentsOperations` * 2019-05-01: :class:`DeploymentsOperations` * 2019-05-10: :class:`DeploymentsOperations` * 2019-07-01: :class:`DeploymentsOperations` * 2019-08-01: :class:`DeploymentsOperations` * 2019-10-01: :class:`DeploymentsOperations` + * 2020-06-01: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2016-02-01': @@ -192,6 +208,8 @@ def deployments(self): from ..v2018_02_01.aio.operations_async import DeploymentsOperations as OperationClass elif api_version == '2018-05-01': from ..v2018_05_01.aio.operations_async import DeploymentsOperations as OperationClass + elif api_version == '2019-03-01': + from ..v2019_03_01.aio.operations_async import DeploymentsOperations as OperationClass elif api_version == '2019-05-01': from ..v2019_05_01.aio.operations_async import DeploymentsOperations as OperationClass elif api_version == '2019-05-10': @@ -202,6 +220,8 @@ def deployments(self): from ..v2019_08_01.aio.operations_async import DeploymentsOperations as OperationClass elif api_version == '2019-10-01': from ..v2019_10_01.aio.operations_async import DeploymentsOperations as OperationClass + elif api_version == '2020-06-01': + from ..v2020_06_01.aio.operations_async import DeploymentsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -211,15 +231,19 @@ def operations(self): """Instance depends on the API version: * 2018-05-01: :class:`Operations` + * 2019-03-01: :class:`Operations` * 2019-05-01: :class:`Operations` * 2019-05-10: :class:`Operations` * 2019-07-01: :class:`Operations` * 2019-08-01: :class:`Operations` * 2019-10-01: :class:`Operations` + * 2020-06-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-05-01': from ..v2018_05_01.aio.operations_async import Operations as OperationClass + elif api_version == '2019-03-01': + from ..v2019_03_01.aio.operations_async import Operations as OperationClass elif api_version == '2019-05-01': from ..v2019_05_01.aio.operations_async import Operations as OperationClass elif api_version == '2019-05-10': @@ -230,6 +254,8 @@ def operations(self): from ..v2019_08_01.aio.operations_async import Operations as OperationClass elif api_version == '2019-10-01': from ..v2019_10_01.aio.operations_async import Operations as OperationClass + elif api_version == '2020-06-01': + from ..v2020_06_01.aio.operations_async import Operations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -243,11 +269,13 @@ def providers(self): * 2017-05-10: :class:`ProvidersOperations` * 2018-02-01: :class:`ProvidersOperations` * 2018-05-01: :class:`ProvidersOperations` + * 2019-03-01: :class:`ProvidersOperations` * 2019-05-01: :class:`ProvidersOperations` * 2019-05-10: :class:`ProvidersOperations` * 2019-07-01: :class:`ProvidersOperations` * 2019-08-01: :class:`ProvidersOperations` * 2019-10-01: :class:`ProvidersOperations` + * 2020-06-01: :class:`ProvidersOperations` """ api_version = self._get_api_version('providers') if api_version == '2016-02-01': @@ -260,6 +288,8 @@ def providers(self): from ..v2018_02_01.aio.operations_async import ProvidersOperations as OperationClass elif api_version == '2018-05-01': from ..v2018_05_01.aio.operations_async import ProvidersOperations as OperationClass + elif api_version == '2019-03-01': + from ..v2019_03_01.aio.operations_async import ProvidersOperations as OperationClass elif api_version == '2019-05-01': from ..v2019_05_01.aio.operations_async import ProvidersOperations as OperationClass elif api_version == '2019-05-10': @@ -270,6 +300,8 @@ def providers(self): from ..v2019_08_01.aio.operations_async import ProvidersOperations as OperationClass elif api_version == '2019-10-01': from ..v2019_10_01.aio.operations_async import ProvidersOperations as OperationClass + elif api_version == '2020-06-01': + from ..v2020_06_01.aio.operations_async import ProvidersOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -283,11 +315,13 @@ def resource_groups(self): * 2017-05-10: :class:`ResourceGroupsOperations` * 2018-02-01: :class:`ResourceGroupsOperations` * 2018-05-01: :class:`ResourceGroupsOperations` + * 2019-03-01: :class:`ResourceGroupsOperations` * 2019-05-01: :class:`ResourceGroupsOperations` * 2019-05-10: :class:`ResourceGroupsOperations` * 2019-07-01: :class:`ResourceGroupsOperations` * 2019-08-01: :class:`ResourceGroupsOperations` * 2019-10-01: :class:`ResourceGroupsOperations` + * 2020-06-01: :class:`ResourceGroupsOperations` """ api_version = self._get_api_version('resource_groups') if api_version == '2016-02-01': @@ -300,6 +334,8 @@ def resource_groups(self): from ..v2018_02_01.aio.operations_async import ResourceGroupsOperations as OperationClass elif api_version == '2018-05-01': from ..v2018_05_01.aio.operations_async import ResourceGroupsOperations as OperationClass + elif api_version == '2019-03-01': + from ..v2019_03_01.aio.operations_async import ResourceGroupsOperations as OperationClass elif api_version == '2019-05-01': from ..v2019_05_01.aio.operations_async import ResourceGroupsOperations as OperationClass elif api_version == '2019-05-10': @@ -310,6 +346,8 @@ def resource_groups(self): from ..v2019_08_01.aio.operations_async import ResourceGroupsOperations as OperationClass elif api_version == '2019-10-01': from ..v2019_10_01.aio.operations_async import ResourceGroupsOperations as OperationClass + elif api_version == '2020-06-01': + from ..v2020_06_01.aio.operations_async import ResourceGroupsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -323,11 +361,13 @@ def resources(self): * 2017-05-10: :class:`ResourcesOperations` * 2018-02-01: :class:`ResourcesOperations` * 2018-05-01: :class:`ResourcesOperations` + * 2019-03-01: :class:`ResourcesOperations` * 2019-05-01: :class:`ResourcesOperations` * 2019-05-10: :class:`ResourcesOperations` * 2019-07-01: :class:`ResourcesOperations` * 2019-08-01: :class:`ResourcesOperations` * 2019-10-01: :class:`ResourcesOperations` + * 2020-06-01: :class:`ResourcesOperations` """ api_version = self._get_api_version('resources') if api_version == '2016-02-01': @@ -340,6 +380,8 @@ def resources(self): from ..v2018_02_01.aio.operations_async import ResourcesOperations as OperationClass elif api_version == '2018-05-01': from ..v2018_05_01.aio.operations_async import ResourcesOperations as OperationClass + elif api_version == '2019-03-01': + from ..v2019_03_01.aio.operations_async import ResourcesOperations as OperationClass elif api_version == '2019-05-01': from ..v2019_05_01.aio.operations_async import ResourcesOperations as OperationClass elif api_version == '2019-05-10': @@ -350,6 +392,8 @@ def resources(self): from ..v2019_08_01.aio.operations_async import ResourcesOperations as OperationClass elif api_version == '2019-10-01': from ..v2019_10_01.aio.operations_async import ResourcesOperations as OperationClass + elif api_version == '2020-06-01': + from ..v2020_06_01.aio.operations_async import ResourcesOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -363,11 +407,13 @@ def tags(self): * 2017-05-10: :class:`TagsOperations` * 2018-02-01: :class:`TagsOperations` * 2018-05-01: :class:`TagsOperations` + * 2019-03-01: :class:`TagsOperations` * 2019-05-01: :class:`TagsOperations` * 2019-05-10: :class:`TagsOperations` * 2019-07-01: :class:`TagsOperations` * 2019-08-01: :class:`TagsOperations` * 2019-10-01: :class:`TagsOperations` + * 2020-06-01: :class:`TagsOperations` """ api_version = self._get_api_version('tags') if api_version == '2016-02-01': @@ -380,6 +426,8 @@ def tags(self): from ..v2018_02_01.aio.operations_async import TagsOperations as OperationClass elif api_version == '2018-05-01': from ..v2018_05_01.aio.operations_async import TagsOperations as OperationClass + elif api_version == '2019-03-01': + from ..v2019_03_01.aio.operations_async import TagsOperations as OperationClass elif api_version == '2019-05-01': from ..v2019_05_01.aio.operations_async import TagsOperations as OperationClass elif api_version == '2019-05-10': @@ -390,6 +438,8 @@ def tags(self): from ..v2019_08_01.aio.operations_async import TagsOperations as OperationClass elif api_version == '2019-10-01': from ..v2019_10_01.aio.operations_async import TagsOperations as OperationClass + elif api_version == '2020-06-01': + from ..v2020_06_01.aio.operations_async import TagsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py index c3d3a5ee0c2d..ead4a104371c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2019_10_01.models import * +from .v2020_06_01.models import * diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_deployment_operations_operations_async.py index 37ae73ca82ad..1d3ce668e052 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_deployment_operations_operations_async.py @@ -84,7 +84,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -127,6 +126,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -142,15 +145,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_deployments_operations_async.py index 2b3439543cea..197e6a882d53 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_deployments_operations_async.py @@ -70,7 +70,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,7 +88,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Delete deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -102,8 +101,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -181,7 +180,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -227,7 +225,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -240,7 +237,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -259,7 +255,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Create a named template deployment using a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -274,8 +270,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -358,7 +354,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,7 +408,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -471,7 +465,6 @@ async def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -484,7 +477,6 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -536,7 +528,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -580,6 +571,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -596,15 +591,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -663,7 +654,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_providers_operations_async.py index 089b3e3c1031..1c2a367a6db4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,6 +167,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -184,15 +186,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -260,7 +258,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_resource_groups_operations_async.py index aec590b902a6..c15b112a5120 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_resource_groups_operations_async.py @@ -74,6 +74,10 @@ def list_resources( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_resources.metadata['url'] # type: ignore @@ -92,15 +96,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -162,7 +162,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -218,7 +217,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -231,7 +229,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -269,7 +266,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,7 +283,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Delete resource group. :param resource_group_name: The name of the resource group to be deleted. The name is case @@ -299,8 +295,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -374,7 +370,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,7 +429,6 @@ async def patch( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -495,7 +489,6 @@ async def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -539,6 +532,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -554,15 +551,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_resources_operations_async.py index eb005fd42c17..fb67dd51801b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_resources_operations_async.py @@ -71,7 +71,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -94,7 +93,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Move resources from one resource group to another. The resources being moved should all be in the same resource group. @@ -108,8 +107,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -176,6 +175,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -193,15 +196,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -278,7 +277,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -343,7 +341,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,7 +410,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -426,7 +422,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GenericResource', pipeline_response) @@ -448,8 +443,8 @@ async def _update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-02-01" @@ -476,7 +471,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -508,7 +502,7 @@ async def begin_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -530,8 +524,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -628,7 +622,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_tags_operations_async.py index 07546a6e525e..a49e476a53e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations_async/_tags_operations_async.py @@ -79,7 +79,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,7 +131,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +139,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -189,7 +186,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -198,7 +194,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -245,7 +240,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -276,6 +270,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -287,15 +285,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployment_operations_operations.py index 331000b25624..5ae2431c5d3b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployment_operations_operations.py @@ -89,7 +89,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -133,6 +132,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -148,15 +151,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployments_operations.py index 5d9107de04c9..78830aca468e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployments_operations.py @@ -75,7 +75,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -95,7 +94,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Delete deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -188,7 +187,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -235,7 +233,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -248,7 +245,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -268,7 +264,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Create a named template deployment using a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -368,7 +364,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -424,7 +419,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -483,7 +477,6 @@ def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -496,7 +489,6 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -549,7 +541,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -594,6 +585,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -610,15 +605,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -678,7 +669,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_providers_operations.py index 9bb2bf57fbd2..8666787b96fa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -176,6 +174,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -191,15 +193,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -268,7 +266,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resource_groups_operations.py index 7688f7fa4f3b..fcb67a08d5af 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resource_groups_operations.py @@ -79,6 +79,10 @@ def list_resources( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_resources.metadata['url'] # type: ignore @@ -97,15 +101,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -168,7 +168,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -225,7 +224,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -238,7 +236,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -277,7 +274,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,7 +292,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Delete resource group. :param resource_group_name: The name of the resource group to be deleted. The name is case @@ -384,7 +380,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -445,7 +440,6 @@ def patch( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -507,7 +501,6 @@ def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -552,6 +545,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -567,15 +564,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resources_operations.py index 2b834aa74a04..b5e9caf56cae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resources_operations.py @@ -76,7 +76,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -100,7 +99,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Move resources from one resource group to another. The resources being moved should all be in the same resource group. @@ -183,6 +182,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -200,15 +203,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -286,7 +285,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,7 +350,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,7 +420,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -436,7 +432,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GenericResource', pipeline_response) @@ -459,8 +454,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-02-01" @@ -487,7 +482,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -520,7 +514,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -641,7 +635,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_tags_operations.py index 69c4a579657e..cb0f681504db 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_tags_operations.py @@ -84,7 +84,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,7 +137,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -196,7 +193,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -205,7 +201,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -253,7 +248,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -285,6 +279,10 @@ def list( api_version = "2016-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -296,15 +294,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_deployment_operations_operations_async.py index 09db7e505e24..3c581fda90d4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_deployment_operations_operations_async.py @@ -84,7 +84,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -127,6 +126,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -142,15 +145,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_deployments_operations_async.py index faa4d8f6797a..260575577ef0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_deployments_operations_async.py @@ -70,7 +70,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,7 +88,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -112,8 +111,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -191,7 +190,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,7 +235,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -250,7 +247,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -269,7 +265,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -287,8 +283,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -370,7 +366,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -430,7 +425,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,7 +484,6 @@ async def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -503,7 +496,6 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -555,7 +547,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -600,6 +591,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -616,15 +611,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -683,7 +674,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_providers_operations_async.py index 43daa68e2c86..7614d7150934 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,6 +168,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +187,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -261,7 +259,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_resource_groups_operations_async.py index 27872c769a22..87189a92adbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_resource_groups_operations_async.py @@ -74,6 +74,10 @@ def list_resources( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_resources.metadata['url'] # type: ignore @@ -92,15 +96,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -162,7 +162,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -217,7 +216,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -230,7 +228,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -268,7 +265,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,7 +282,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -301,8 +297,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -376,7 +372,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -438,7 +433,6 @@ async def patch( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -499,7 +493,6 @@ async def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -543,6 +536,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -558,15 +555,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_resources_operations_async.py index 5f77dbab0f99..fc14c1d8b743 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_resources_operations_async.py @@ -71,7 +71,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -94,7 +93,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -113,8 +112,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -181,6 +180,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -198,15 +201,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -284,7 +283,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -332,7 +330,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -354,7 +351,7 @@ async def begin_delete( resource_type: str, resource_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -374,8 +371,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -426,8 +423,8 @@ async def _create_or_update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -454,7 +451,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -489,7 +485,7 @@ async def begin_create_or_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -511,8 +507,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -567,8 +563,8 @@ async def _update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -595,7 +591,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -627,7 +622,7 @@ async def begin_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -649,8 +644,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -748,7 +743,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -800,7 +794,6 @@ async def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -839,7 +832,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -857,7 +849,7 @@ async def begin_delete_by_id( self, resource_id: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -870,8 +862,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -914,8 +906,8 @@ async def _create_or_update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -937,7 +929,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -968,7 +959,7 @@ async def begin_create_or_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -983,8 +974,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1031,8 +1022,8 @@ async def _update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -1054,7 +1045,6 @@ async def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1082,7 +1072,7 @@ async def begin_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1097,8 +1087,8 @@ async def begin_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1176,7 +1166,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_tags_operations_async.py index 857d6421a854..6503f5aff616 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations_async/_tags_operations_async.py @@ -79,7 +79,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,7 +131,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +139,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -193,7 +190,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -251,7 +246,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,6 +276,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -293,15 +291,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployment_operations_operations.py index 2e4c5bfa9f49..3ec41ac66be5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployment_operations_operations.py @@ -89,7 +89,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -133,6 +132,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -148,15 +151,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployments_operations.py index 5b568491fa1a..b81771172c70 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployments_operations.py @@ -75,7 +75,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -95,7 +94,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -198,7 +197,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,7 +243,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -258,7 +255,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -278,7 +274,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -380,7 +376,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -441,7 +436,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,7 +496,6 @@ def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -515,7 +508,6 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -568,7 +560,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -614,6 +605,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -630,15 +625,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -698,7 +689,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_providers_operations.py index e66cbe6b1bb0..8d6f982beb87 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,6 +175,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +194,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -269,7 +267,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resource_groups_operations.py index 43e1d6f1ad3c..5197496d4da6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resource_groups_operations.py @@ -79,6 +79,10 @@ def list_resources( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_resources.metadata['url'] # type: ignore @@ -97,15 +101,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -168,7 +168,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -224,7 +223,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -237,7 +235,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -276,7 +273,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -295,7 +291,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -386,7 +382,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -449,7 +444,6 @@ def patch( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -511,7 +505,6 @@ def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -556,6 +549,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -571,15 +568,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resources_operations.py index 11666d88f559..6d4c9fb85354 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resources_operations.py @@ -76,7 +76,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -100,7 +99,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -188,6 +187,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -205,15 +208,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -292,7 +291,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -341,7 +339,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,7 +361,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -437,8 +434,8 @@ def _create_or_update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -465,7 +462,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -501,7 +497,7 @@ def begin_create_or_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -580,8 +576,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -608,7 +604,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -641,7 +636,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -763,7 +758,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -816,7 +810,6 @@ def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -856,7 +849,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -875,7 +867,7 @@ def begin_delete_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -933,8 +925,8 @@ def _create_or_update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -956,7 +948,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -988,7 +979,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1052,8 +1043,8 @@ def _update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2016-09-01" @@ -1075,7 +1066,6 @@ def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1104,7 +1094,7 @@ def begin_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1199,7 +1189,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_tags_operations.py index 7df48c26b18f..ba6c79d2bcd0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_tags_operations.py @@ -84,7 +84,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,7 +137,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -200,7 +197,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +205,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -259,7 +254,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +285,10 @@ def list( api_version = "2016-09-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +300,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_deployment_operations_operations_async.py index ec320a0449e9..92e2139fb786 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_deployment_operations_operations_async.py @@ -84,7 +84,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -127,6 +126,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -142,15 +145,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_deployments_operations_async.py index fcfb0329e74e..b93238b46af7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_deployments_operations_async.py @@ -70,7 +70,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,7 +88,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -112,8 +111,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -191,7 +190,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,7 +235,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -250,7 +247,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -269,7 +265,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -287,8 +283,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -370,7 +366,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -430,7 +425,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,7 +484,6 @@ async def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -503,7 +496,6 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -555,7 +547,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -600,6 +591,10 @@ def list_by_resource_group( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -616,15 +611,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -683,7 +674,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_providers_operations_async.py index b0b9cab22369..661f9be4a14a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,6 +168,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +187,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -261,7 +259,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_resource_groups_operations_async.py index 19413b3049c9..c7d194220d8a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_resource_groups_operations_async.py @@ -78,7 +78,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -133,7 +132,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -146,7 +144,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -184,7 +181,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -217,8 +213,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -292,7 +288,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -354,7 +349,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -415,7 +409,6 @@ async def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -459,6 +452,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -474,15 +471,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_resources_operations_async.py index be76249c728c..10dae18bc158 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_resources_operations_async.py @@ -74,6 +74,10 @@ def list_by_resource_group( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -92,15 +96,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -155,7 +155,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -178,7 +177,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -197,8 +196,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -265,7 +264,6 @@ async def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -288,7 +286,7 @@ async def begin_validate_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -309,8 +307,8 @@ async def begin_validate_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -377,6 +375,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -394,15 +396,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -480,7 +478,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -528,7 +525,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,7 +546,7 @@ async def begin_delete( resource_type: str, resource_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -570,8 +566,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -622,8 +618,8 @@ async def _create_or_update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-05-10" @@ -650,7 +646,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -685,7 +680,7 @@ async def begin_create_or_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -707,8 +702,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -763,8 +758,8 @@ async def _update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-05-10" @@ -791,7 +786,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -823,7 +817,7 @@ async def begin_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -845,8 +839,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -944,7 +938,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -996,7 +989,6 @@ async def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1035,7 +1027,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1053,7 +1044,7 @@ async def begin_delete_by_id( self, resource_id: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1066,8 +1057,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1110,8 +1101,8 @@ async def _create_or_update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-05-10" @@ -1133,7 +1124,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1164,7 +1154,7 @@ async def begin_create_or_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1179,8 +1169,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1227,8 +1217,8 @@ async def _update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-05-10" @@ -1250,7 +1240,6 @@ async def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1278,7 +1267,7 @@ async def begin_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1293,8 +1282,8 @@ async def begin_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1372,7 +1361,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_tags_operations_async.py index 6243dcab411f..5f2ea63cbe51 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations_async/_tags_operations_async.py @@ -79,7 +79,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,7 +131,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +139,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -193,7 +190,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -251,7 +246,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,6 +276,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -293,15 +291,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployment_operations_operations.py index 7316862421c7..1defcdfd8992 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployment_operations_operations.py @@ -89,7 +89,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -133,6 +132,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -148,15 +151,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployments_operations.py index 64afcbf56af5..0da881d75618 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployments_operations.py @@ -75,7 +75,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -95,7 +94,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -198,7 +197,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,7 +243,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -258,7 +255,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -278,7 +274,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -380,7 +376,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -441,7 +436,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,7 +496,6 @@ def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -515,7 +508,6 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -568,7 +560,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -614,6 +605,10 @@ def list_by_resource_group( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -630,15 +625,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -698,7 +689,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_providers_operations.py index 1ad8fef8a342..15f71eebc784 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,6 +175,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +194,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -269,7 +267,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resource_groups_operations.py index 39a39ed5d7c3..060d2b2e74e1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resource_groups_operations.py @@ -83,7 +83,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -139,7 +138,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -152,7 +150,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -191,7 +188,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -210,7 +206,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -301,7 +297,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,7 +359,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -426,7 +420,6 @@ def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -471,6 +464,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -486,15 +483,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resources_operations.py index ca473463d1d6..13a6481448e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resources_operations.py @@ -79,6 +79,10 @@ def list_by_resource_group( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -97,15 +101,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -161,7 +161,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -185,7 +184,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -273,7 +272,6 @@ def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -297,7 +295,7 @@ def begin_validate_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -387,6 +385,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -404,15 +406,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -491,7 +489,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -540,7 +537,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -563,7 +559,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -636,8 +632,8 @@ def _create_or_update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-05-10" @@ -664,7 +660,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -700,7 +695,7 @@ def begin_create_or_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -779,8 +774,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-05-10" @@ -807,7 +802,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -840,7 +834,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -962,7 +956,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1015,7 +1008,6 @@ def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1055,7 +1047,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1074,7 +1065,7 @@ def begin_delete_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1132,8 +1123,8 @@ def _create_or_update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-05-10" @@ -1155,7 +1146,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1187,7 +1177,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1251,8 +1241,8 @@ def _update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2017-05-10" @@ -1274,7 +1264,6 @@ def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1303,7 +1292,7 @@ def begin_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1398,7 +1387,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_tags_operations.py index 3c9aac1fb299..c3caa166ae83 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_tags_operations.py @@ -84,7 +84,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,7 +137,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -200,7 +197,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +205,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -259,7 +254,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +285,10 @@ def list( api_version = "2017-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +300,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_deployment_operations_operations_async.py index fa70bd4b2fc9..22230a2d6463 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_deployment_operations_operations_async.py @@ -84,7 +84,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -127,6 +126,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -142,15 +145,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_deployments_operations_async.py index 38ee33c3ec42..92e65ba4eeae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_deployments_operations_async.py @@ -70,7 +70,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,7 +88,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -112,8 +111,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -191,7 +190,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,7 +235,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -250,7 +247,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -269,7 +265,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -287,8 +283,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -370,7 +366,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -430,7 +425,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,7 +484,6 @@ async def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -503,7 +496,6 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -555,7 +547,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -600,6 +591,10 @@ def list_by_resource_group( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -616,15 +611,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -683,7 +674,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_providers_operations_async.py index bd95ecb7ddad..8ad776a2eabf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,6 +168,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +187,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -261,7 +259,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_resource_groups_operations_async.py index f895f63c372f..1a2a1661ee88 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_resource_groups_operations_async.py @@ -78,7 +78,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -133,7 +132,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -146,7 +144,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -184,7 +181,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -217,8 +213,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -292,7 +288,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -354,7 +349,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -415,7 +409,6 @@ async def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -459,6 +452,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -474,15 +471,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_resources_operations_async.py index 813d58b62273..4a9fd51b84eb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_resources_operations_async.py @@ -74,6 +74,10 @@ def list_by_resource_group( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -92,15 +96,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -155,7 +155,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -178,7 +177,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -197,8 +196,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -265,7 +264,6 @@ async def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -288,7 +286,7 @@ async def begin_validate_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -309,8 +307,8 @@ async def begin_validate_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -375,6 +373,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -392,15 +394,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -478,7 +476,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,7 +523,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -548,7 +544,7 @@ async def begin_delete( resource_type: str, resource_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -568,8 +564,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -620,8 +616,8 @@ async def _create_or_update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -648,7 +644,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -683,7 +678,7 @@ async def begin_create_or_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -705,8 +700,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -761,8 +756,8 @@ async def _update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -789,7 +784,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -821,7 +815,7 @@ async def begin_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -843,8 +837,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -942,7 +936,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -994,7 +987,6 @@ async def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1033,7 +1025,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1051,7 +1042,7 @@ async def begin_delete_by_id( self, resource_id: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1064,8 +1055,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1108,8 +1099,8 @@ async def _create_or_update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1131,7 +1122,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1162,7 +1152,7 @@ async def begin_create_or_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1177,8 +1167,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1225,8 +1215,8 @@ async def _update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1248,7 +1238,6 @@ async def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1276,7 +1265,7 @@ async def begin_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1291,8 +1280,8 @@ async def begin_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1370,7 +1359,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_tags_operations_async.py index 20aa4805eb3a..0606315cc6a5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations_async/_tags_operations_async.py @@ -79,7 +79,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,7 +131,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +139,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -193,7 +190,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -251,7 +246,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,6 +276,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -293,15 +291,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployment_operations_operations.py index f025d8502004..bf050e2741e7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployment_operations_operations.py @@ -89,7 +89,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -133,6 +132,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -148,15 +151,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployments_operations.py index 8f289a0111a4..8da38e88518c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployments_operations.py @@ -75,7 +75,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -95,7 +94,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -198,7 +197,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,7 +243,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -258,7 +255,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -278,7 +274,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -380,7 +376,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -441,7 +436,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,7 +496,6 @@ def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -515,7 +508,6 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -568,7 +560,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -614,6 +605,10 @@ def list_by_resource_group( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -630,15 +625,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -698,7 +689,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_providers_operations.py index 8a1f12c4d858..4073fb56c76e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,6 +175,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +194,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -269,7 +267,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resource_groups_operations.py index 405f38fcb998..bc4df7f5b9ac 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resource_groups_operations.py @@ -83,7 +83,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -139,7 +138,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -152,7 +150,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -191,7 +188,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -210,7 +206,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -301,7 +297,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,7 +359,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -426,7 +420,6 @@ def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -471,6 +464,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -486,15 +483,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resources_operations.py index 2550d7050cc9..21bbb7a8ae8e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resources_operations.py @@ -79,6 +79,10 @@ def list_by_resource_group( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -97,15 +101,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -161,7 +161,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -185,7 +184,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -273,7 +272,6 @@ def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -297,7 +295,7 @@ def begin_validate_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -385,6 +383,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -402,15 +404,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -489,7 +487,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -538,7 +535,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -561,7 +557,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -634,8 +630,8 @@ def _create_or_update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -662,7 +658,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -698,7 +693,7 @@ def begin_create_or_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -777,8 +772,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -805,7 +800,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -838,7 +832,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -960,7 +954,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1013,7 +1006,6 @@ def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1053,7 +1045,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1072,7 +1063,7 @@ def begin_delete_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1130,8 +1121,8 @@ def _create_or_update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1153,7 +1144,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1185,7 +1175,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1249,8 +1239,8 @@ def _update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-01" @@ -1272,7 +1262,6 @@ def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1301,7 +1290,7 @@ def begin_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1396,7 +1385,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_tags_operations.py index 1de6bc768b00..e972a83714fd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_tags_operations.py @@ -84,7 +84,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,7 +137,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -200,7 +197,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +205,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -259,7 +254,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +285,10 @@ def list( api_version = "2018-02-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +300,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_deployment_operations_operations_async.py index 436189fa6cde..1c16b6a66fb6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_deployment_operations_operations_async.py @@ -80,7 +80,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,6 +119,10 @@ def list_at_subscription_scope( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -134,15 +137,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -212,7 +211,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,6 +253,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -270,15 +272,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_deployments_operations_async.py index d3170fc8f79d..396916aea5bf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_deployments_operations_async.py @@ -68,7 +68,6 @@ async def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -86,7 +85,7 @@ async def begin_delete_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -105,8 +104,8 @@ async def begin_delete_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -178,7 +177,6 @@ async def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,7 +220,6 @@ async def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -235,7 +232,6 @@ async def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -253,7 +249,7 @@ async def begin_create_or_update_at_subscription_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -268,8 +264,8 @@ async def begin_create_or_update_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -346,7 +342,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -402,7 +397,6 @@ async def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -457,7 +451,6 @@ async def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -470,7 +463,6 @@ async def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -518,7 +510,6 @@ async def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -559,6 +550,10 @@ def list_at_subscription_scope( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -574,15 +569,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -636,7 +627,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -655,7 +645,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -678,8 +668,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -757,7 +747,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -803,7 +792,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -816,7 +804,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -835,7 +822,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -853,8 +840,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -936,7 +923,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -996,7 +982,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1056,7 +1041,6 @@ async def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1069,7 +1053,6 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1121,7 +1104,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1166,6 +1148,10 @@ def list_by_resource_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -1182,15 +1168,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1249,7 +1231,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_operations_async.py index 50b323119e8a..692516e43736 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_providers_operations_async.py index efabad343fea..e4a9142f3f46 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,6 +168,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +187,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -261,7 +259,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_resource_groups_operations_async.py index 552ea2bdfc5f..f148dc84eb80 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_resource_groups_operations_async.py @@ -78,7 +78,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -135,7 +134,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -148,7 +146,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -186,7 +183,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -204,7 +200,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -219,8 +215,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -294,7 +290,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -356,7 +351,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -417,7 +411,6 @@ async def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -463,6 +456,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -478,15 +475,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_resources_operations_async.py index 08bf29a80cf7..09b9fd253b54 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_resources_operations_async.py @@ -86,6 +86,10 @@ def list_by_resource_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -104,15 +108,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -167,7 +167,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -190,7 +189,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -209,8 +208,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -277,7 +276,6 @@ async def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -300,7 +298,7 @@ async def begin_validate_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -321,8 +319,8 @@ async def begin_validate_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -401,6 +399,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -418,15 +420,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -504,7 +502,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -552,7 +549,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -574,7 +570,7 @@ async def begin_delete( resource_type: str, resource_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -594,8 +590,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -646,8 +642,8 @@ async def _create_or_update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -674,7 +670,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -709,7 +704,7 @@ async def begin_create_or_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -731,8 +726,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -787,8 +782,8 @@ async def _update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -815,7 +810,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -847,7 +841,7 @@ async def begin_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -869,8 +863,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -968,7 +962,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1020,7 +1013,6 @@ async def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1059,7 +1051,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1077,7 +1068,7 @@ async def begin_delete_by_id( self, resource_id: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1090,8 +1081,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1134,8 +1125,8 @@ async def _create_or_update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -1157,7 +1148,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1188,7 +1178,7 @@ async def begin_create_or_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1203,8 +1193,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1251,8 +1241,8 @@ async def _update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -1274,7 +1264,6 @@ async def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1302,7 +1291,7 @@ async def begin_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1317,8 +1306,8 @@ async def begin_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1396,7 +1385,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_tags_operations_async.py index 3671c2bb5532..2502aba2119c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations_async/_tags_operations_async.py @@ -79,7 +79,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,7 +131,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +139,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -193,7 +190,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -251,7 +246,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,6 +276,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -293,15 +291,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployment_operations_operations.py index 9b382ad50a49..6dd4c823000d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployment_operations_operations.py @@ -85,7 +85,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -126,6 +125,10 @@ def list_at_subscription_scope( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -140,15 +143,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -219,7 +218,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -263,6 +261,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -278,15 +280,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployments_operations.py index cff74862c486..f5e5fea89c67 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployments_operations.py @@ -73,7 +73,6 @@ def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -92,7 +91,7 @@ def begin_delete_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -185,7 +184,6 @@ def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,7 +228,6 @@ def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -243,7 +240,6 @@ def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -262,7 +258,7 @@ def begin_create_or_update_at_subscription_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -356,7 +352,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,7 +408,6 @@ def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -469,7 +463,6 @@ def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -482,7 +475,6 @@ def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -531,7 +523,6 @@ def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -573,6 +564,10 @@ def list_at_subscription_scope( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -588,15 +583,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -651,7 +642,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -671,7 +661,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -774,7 +764,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -821,7 +810,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -834,7 +822,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -854,7 +841,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -956,7 +943,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1017,7 +1003,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1078,7 +1063,6 @@ def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1091,7 +1075,6 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1144,7 +1127,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1190,6 +1172,10 @@ def list_by_resource_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -1206,15 +1192,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1274,7 +1256,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py index 2acfaf7bcb5e..14bb61cad55f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_providers_operations.py index 809f22fc03a0..6a890d407f44 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,6 +175,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +194,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -269,7 +267,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resource_groups_operations.py index 949639a0e9c5..c09fa4d71b27 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resource_groups_operations.py @@ -83,7 +83,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +140,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -154,7 +152,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -193,7 +190,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,7 +208,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -303,7 +299,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -366,7 +361,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -428,7 +422,6 @@ def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -475,6 +468,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -490,15 +487,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resources_operations.py index f6184604beb5..91d3eb4357b8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resources_operations.py @@ -91,6 +91,10 @@ def list_by_resource_group( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -109,15 +113,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -173,7 +173,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -197,7 +196,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -285,7 +284,6 @@ def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -309,7 +307,7 @@ def begin_validate_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -411,6 +409,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -428,15 +430,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -515,7 +513,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,7 +561,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -587,7 +583,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -660,8 +656,8 @@ def _create_or_update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -688,7 +684,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -724,7 +719,7 @@ def begin_create_or_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -803,8 +798,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -831,7 +826,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -864,7 +858,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -986,7 +980,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1039,7 +1032,6 @@ def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,7 +1071,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1098,7 +1089,7 @@ def begin_delete_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1156,8 +1147,8 @@ def _create_or_update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -1179,7 +1170,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1211,7 +1201,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1275,8 +1265,8 @@ def _update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2018-05-01" @@ -1298,7 +1288,6 @@ def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1327,7 +1316,7 @@ def begin_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1422,7 +1411,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_tags_operations.py index 3f2f1085271c..aa01f3480a6b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_tags_operations.py @@ -84,7 +84,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,7 +137,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -200,7 +197,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +205,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -259,7 +254,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +285,10 @@ def list( api_version = "2018-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +300,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/__init__.py new file mode 100644 index 000000000000..fde2ed4c3b83 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._resource_management_client import ResourceManagementClient +__all__ = ['ResourceManagementClient'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_configuration.py new file mode 100644 index 000000000000..6ec30294cdb7 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_configuration.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ResourceManagementClientConfiguration(Configuration): + """Configuration for ResourceManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ResourceManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-03-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json new file mode 100644 index 000000000000..8b27ced7a043 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json @@ -0,0 +1,59 @@ +{ + "chosen_version": "2019-03-01", + "total_api_version_list": ["2019-03-01"], + "client": { + "name": "ResourceManagementClient", + "filename": "_resource_management_client", + "description": "Provides operations for working with resources and resource groups." + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] + }, + "operation_groups": { + "operations": "Operations", + "deployments": "DeploymentsOperations", + "providers": "ProvidersOperations", + "resources": "ResourcesOperations", + "resource_groups": "ResourceGroupsOperations", + "tags": "TagsOperations", + "deployment_operations": "DeploymentOperationsOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py new file mode 100644 index 000000000000..3e7061d253f4 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import ResourceManagementClientConfiguration +from .operations import Operations +from .operations import DeploymentsOperations +from .operations import ProvidersOperations +from .operations import ResourcesOperations +from .operations import ResourceGroupsOperations +from .operations import TagsOperations +from .operations import DeploymentOperationsOperations +from . import models + + +class ResourceManagementClient(object): + """Provides operations for working with resources and resource groups. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resource.resources.v2019_03_01.operations.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.resource.resources.v2019_03_01.operations.DeploymentsOperations + :ivar providers: ProvidersOperations operations + :vartype providers: azure.mgmt.resource.resources.v2019_03_01.operations.ProvidersOperations + :ivar resources: ResourcesOperations operations + :vartype resources: azure.mgmt.resource.resources.v2019_03_01.operations.ResourcesOperations + :ivar resource_groups: ResourceGroupsOperations operations + :vartype resource_groups: azure.mgmt.resource.resources.v2019_03_01.operations.ResourceGroupsOperations + :ivar tags: TagsOperations operations + :vartype tags: azure.mgmt.resource.resources.v2019_03_01.operations.TagsOperations + :ivar deployment_operations: DeploymentOperationsOperations operations + :vartype deployment_operations: azure.mgmt.resource.resources.v2019_03_01.operations.DeploymentOperationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ResourceManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.providers = ProvidersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resources = ResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_groups = ResourceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tags = TagsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployment_operations = DeploymentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ResourceManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/__init__.py new file mode 100644 index 000000000000..7f9b1bac71c5 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._resource_management_client_async import ResourceManagementClient +__all__ = ['ResourceManagementClient'] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_configuration_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_configuration_async.py new file mode 100644 index 000000000000..569f1515149d --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_configuration_async.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ResourceManagementClientConfiguration(Configuration): + """Configuration for ResourceManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ResourceManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-03-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client_async.py new file mode 100644 index 000000000000..c1843e99d288 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client_async.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration_async import ResourceManagementClientConfiguration +from .operations_async import Operations +from .operations_async import DeploymentsOperations +from .operations_async import ProvidersOperations +from .operations_async import ResourcesOperations +from .operations_async import ResourceGroupsOperations +from .operations_async import TagsOperations +from .operations_async import DeploymentOperationsOperations +from .. import models + + +class ResourceManagementClient(object): + """Provides operations for working with resources and resource groups. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resource.resources.v2019_03_01.aio.operations_async.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.resource.resources.v2019_03_01.aio.operations_async.DeploymentsOperations + :ivar providers: ProvidersOperations operations + :vartype providers: azure.mgmt.resource.resources.v2019_03_01.aio.operations_async.ProvidersOperations + :ivar resources: ResourcesOperations operations + :vartype resources: azure.mgmt.resource.resources.v2019_03_01.aio.operations_async.ResourcesOperations + :ivar resource_groups: ResourceGroupsOperations operations + :vartype resource_groups: azure.mgmt.resource.resources.v2019_03_01.aio.operations_async.ResourceGroupsOperations + :ivar tags: TagsOperations operations + :vartype tags: azure.mgmt.resource.resources.v2019_03_01.aio.operations_async.TagsOperations + :ivar deployment_operations: DeploymentOperationsOperations operations + :vartype deployment_operations: azure.mgmt.resource.resources.v2019_03_01.aio.operations_async.DeploymentOperationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ResourceManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.providers = ProvidersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resources = ResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_groups = ResourceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tags = TagsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployment_operations = DeploymentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ResourceManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..f1fd8637fa69 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations_async import Operations +from ._deployments_operations_async import DeploymentsOperations +from ._providers_operations_async import ProvidersOperations +from ._resources_operations_async import ResourcesOperations +from ._resource_groups_operations_async import ResourceGroupsOperations +from ._tags_operations_async import TagsOperations +from ._deployment_operations_operations_async import DeploymentOperationsOperations + +__all__ = [ + 'Operations', + 'DeploymentsOperations', + 'ProvidersOperations', + 'ResourcesOperations', + 'ResourceGroupsOperations', + 'TagsOperations', + 'DeploymentOperationsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_deployment_operations_operations_async.py new file mode 100644 index 000000000000..0512a324bb0d --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_deployment_operations_operations_async.py @@ -0,0 +1,304 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentOperationsOperations: + """DeploymentOperationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_at_subscription_scope( + self, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "models.DeploymentOperation": + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_subscription_scope( + self, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment with the operation to get. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + async def get( + self, + resource_group_name: str, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "models.DeploymentOperation": + """Gets a deployments operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list( + self, + resource_group_name: str, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment with the operation to get. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_deployments_operations_async.py new file mode 100644 index 000000000000..6b4c9baaacb0 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_deployments_operations_async.py @@ -0,0 +1,1252 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations: + """DeploymentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_at_subscription_scope_initial( + self, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment to delete. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_at_subscription_scope_initial( + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> None: + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment to check. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_at_subscription_scope_initial( + self, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> "models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update_at_subscription_scope( + self, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentExtended"]: + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExtended": + """Gets a deployment. + + :param deployment_name: The name of the deployment to get. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment to cancel. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.cancel_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def validate_at_subscription_scope( + self, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> "models.DeploymentValidateResult": + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def export_template_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment from which to get the template. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.export_template_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_subscription_scope( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentListResult"]: + """Get all the deployments for a subscription. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. Deleting a template deployment does + not affect the state of the resource group. This is an asynchronous operation that returns a + status of 202 until the template deployment is successfully deleted. The Location response + header contains the URI that is used to obtain the status of the process. While the process is + running, a call to the URI in the Location header returns a status of 202. When the process + finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param resource_group_name: The name of the resource group with the deployment to delete. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment to delete. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> None: + """Checks whether the deployment exists. + + :param resource_group_name: The name of the resource group with the deployment to check. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment to check. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> "models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentExtended"]: + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExtended": + """Gets a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment to get. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resource group + partially deployed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment to cancel. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.cancel.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def validate( + self, + resource_group_name: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> "models.DeploymentValidateResult": + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def export_template( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment from which to get the template. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.export_template.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentListResult"]: + """Get all the deployments for a resource group. + + :param resource_group_name: The name of the resource group with the deployments to get. The + name is case insensitive. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def calculate_template_hash( + self, + template: object, + **kwargs + ) -> "models.TemplateHashResult": + """Calculate the hash of the given template. + + :param template: The template provided to calculate hash. + :type template: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateHashResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TemplateHashResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.calculate_template_hash.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(template, 'object') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TemplateHashResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + calculate_template_hash.metadata = {'url': '/providers/Microsoft.Resources/calculateTemplateHash'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_operations_async.py new file mode 100644 index 000000000000..7932b1e41b98 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_operations_async.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationListResult"]: + """Lists all of the available Microsoft.Resources REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Resources/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_providers_operations_async.py new file mode 100644 index 000000000000..655fb74fc964 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_providers_operations_async.py @@ -0,0 +1,276 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProvidersOperations: + """ProvidersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def unregister( + self, + resource_provider_namespace: str, + **kwargs + ) -> "models.Provider": + """Unregisters a subscription from a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to unregister. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.unregister.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + unregister.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister'} # type: ignore + + async def register( + self, + resource_provider_namespace: str, + **kwargs + ) -> "models.Provider": + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.register.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + register.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register'} # type: ignore + + def list( + self, + top: Optional[int] = None, + expand: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ProviderListResult"]: + """Gets all resource providers for a subscription. + + :param top: The number of results to return. If null is passed returns all deployments. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers'} # type: ignore + + async def get( + self, + resource_provider_namespace: str, + expand: Optional[str] = None, + **kwargs + ) -> "models.Provider": + """Gets the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_resource_groups_operations_async.py new file mode 100644 index 000000000000..816de13c4075 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_resource_groups_operations_async.py @@ -0,0 +1,507 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceGroupsOperations: + """ResourceGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_existence( + self, + resource_group_name: str, + **kwargs + ) -> None: + """Checks whether a resource group exists. + + :param resource_group_name: The name of the resource group to check. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + parameters: "models.ResourceGroup", + **kwargs + ) -> "models.ResourceGroup": + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a resource group. + + When you delete a resource group, all of its resources are also deleted. Deleting a resource + group deletes all of its template deployments and currently stored operations. + + :param resource_group_name: The name of the resource group to delete. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + **kwargs + ) -> "models.ResourceGroup": + """Gets a resource group. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + parameters: "models.ResourceGroupPatchable", + **kwargs + ) -> "models.ResourceGroup": + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def export_template( + self, + resource_group_name: str, + parameters: "models.ExportTemplateRequest", + **kwargs + ) -> "models.ResourceGroupExportResult": + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group to export as a template. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ExportTemplateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroupExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.export_template.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ExportTemplateRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.ResourceGroupListResult"]: + """Gets all the resource groups for a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by + tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq + 'tag1' and tagValue eq 'Value1'. + :type filter: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_resources_operations_async.py new file mode 100644 index 000000000000..df51ca08605d --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_resources_operations_async.py @@ -0,0 +1,1402 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourcesOperations: + """ResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.ResourceListResult"]: + """Get all the resources for a resource group. + + :param resource_group_name: The resource group with the resources to get. + :type resource_group_name: str + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1':code:`
`:code:`
`You can use some + properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resources. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources'} # type: ignore + + async def _move_resources_initial( + self, + source_resource_group_name: str, + parameters: "models.ResourcesMoveInfo", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + async def begin_move_resources( + self, + source_resource_group_name: str, + parameters: "models.ResourcesMoveInfo", + **kwargs + ) -> AsyncLROPoller[None]: + """Moves resources from one resource group to another resource group. + + The resources to move must be in the same source resource group. The target resource group may + be in a different subscription. When moving resources, both the source group and the target + group are locked for the duration of the operation. Write and delete operations are blocked on + the groups until the move completes. + + :param source_resource_group_name: The name of the resource group containing the resources to + move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourcesMoveInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + async def _validate_move_resources_initial( + self, + source_resource_group_name: str, + parameters: "models.ResourcesMoveInfo", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204, 409]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _validate_move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + async def begin_validate_move_resources( + self, + source_resource_group_name: str, + parameters: "models.ResourcesMoveInfo", + **kwargs + ) -> AsyncLROPoller[None]: + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to move must be in the same source resource group. The target resource group may be in a + different subscription. If validation succeeds, it returns HTTP response code 204 (no content). + If validation fails, it returns HTTP response code 409 (Conflict) with an error message. + Retrieve the URL in the Location header value to check the result of the long-running + operation. + + :param source_resource_group_name: The name of the resource group containing the resources to + validate for move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourcesMoveInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.ResourceListResult"]: + """Get all the resources in a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1':code:`
`:code:`
`You can use some + properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + + async def check_existence( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + **kwargs + ) -> None: + """Checks whether a resource exists. + + :param resource_group_name: The name of the resource group containing the resource to check. + The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The resource provider of the resource to check. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to check whether it exists. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a resource. + + :param resource_group_name: The name of the resource group that contains the resource to + delete. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to delete. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + parameters: "models.GenericResource", + **kwargs + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + parameters: "models.GenericResource", + **kwargs + ) -> AsyncLROPoller["models.GenericResource"]: + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. + :type resource_type: str + :param resource_name: The name of the resource to create. + :type resource_name: str + :param parameters: Parameters for creating or updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + parameters: "models.GenericResource", + **kwargs + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + parameters: "models.GenericResource", + **kwargs + ) -> AsyncLROPoller["models.GenericResource"]: + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. + :type resource_type: str + :param resource_name: The name of the resource to update. + :type resource_name: str + :param parameters: Parameters for updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + **kwargs + ) -> "models.GenericResource": + """Gets a resource. + + :param resource_group_name: The name of the resource group containing the resource to get. The + name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def check_existence_by_id( + self, + resource_id: str, + **kwargs + ) -> None: + """Checks by ID whether a resource exists. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def _delete_by_id_initial( + self, + resource_id: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + async def begin_delete_by_id( + self, + resource_id: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_by_id_initial( + resource_id=resource_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def _create_or_update_by_id_initial( + self, + resource_id: str, + parameters: "models.GenericResource", + **kwargs + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + async def begin_create_or_update_by_id( + self, + resource_id: str, + parameters: "models.GenericResource", + **kwargs + ) -> AsyncLROPoller["models.GenericResource"]: + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param parameters: Create or update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_by_id_initial( + resource_id=resource_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def _update_by_id_initial( + self, + resource_id: str, + parameters: "models.GenericResource", + **kwargs + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + async def begin_update_by_id( + self, + resource_id: str, + parameters: "models.GenericResource", + **kwargs + ) -> AsyncLROPoller["models.GenericResource"]: + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param parameters: Update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_by_id_initial( + resource_id=resource_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def get_by_id( + self, + resource_id: str, + **kwargs + ) -> "models.GenericResource": + """Gets a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_id.metadata = {'url': '/{resourceId}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_tags_operations_async.py new file mode 100644 index 000000000000..6319ab5705e7 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations_async/_tags_operations_async.py @@ -0,0 +1,323 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TagsOperations: + """TagsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def delete_value( + self, + tag_name: str, + tag_value: str, + **kwargs + ) -> None: + """Deletes a tag value. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to delete. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.delete_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + async def create_or_update_value( + self, + tag_name: str, + tag_value: str, + **kwargs + ) -> "models.TagValue": + """Creates a tag value. The name of the tag must already exist. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to create. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagValue, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TagValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.create_or_update_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagValue', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + async def create_or_update( + self, + tag_name: str, + **kwargs + ) -> "models.TagDetails": + """Creates a tag in the subscription. + + The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by + Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these + prefixes. + + :param tag_name: The name of the tag to create. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagDetails, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TagDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + async def delete( + self, + tag_name: str, + **kwargs + ) -> None: + """Deletes a tag from the subscription. + + You must remove all values from a resource tag before you can delete it. + + :param tag_name: The name of the tag. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["models.TagsListResult"]: + """Gets the names and values of all resource tags that are defined in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TagsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.TagsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TagsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/__init__.py new file mode 100644 index 000000000000..b94776ab3cce --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/__init__.py @@ -0,0 +1,187 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AliasPathType + from ._models_py3 import AliasType + from ._models_py3 import BasicDependency + from ._models_py3 import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties + from ._models_py3 import DebugSetting + from ._models_py3 import Dependency + from ._models_py3 import Deployment + from ._models_py3 import DeploymentExportResult + from ._models_py3 import DeploymentExtended + from ._models_py3 import DeploymentExtendedFilter + from ._models_py3 import DeploymentListResult + from ._models_py3 import DeploymentOperation + from ._models_py3 import DeploymentOperationProperties + from ._models_py3 import DeploymentOperationsListResult + from ._models_py3 import DeploymentProperties + from ._models_py3 import DeploymentPropertiesExtended + from ._models_py3 import DeploymentValidateResult + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ExportTemplateRequest + from ._models_py3 import GenericResource + from ._models_py3 import GenericResourceExpanded + from ._models_py3 import GenericResourceFilter + from ._models_py3 import HttpMessage + from ._models_py3 import Identity + from ._models_py3 import OnErrorDeployment + from ._models_py3 import OnErrorDeploymentExtended + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import ParametersLink + from ._models_py3 import Plan + from ._models_py3 import Provider + from ._models_py3 import ProviderListResult + from ._models_py3 import ProviderResourceType + from ._models_py3 import Resource + from ._models_py3 import ResourceGroup + from ._models_py3 import ResourceGroupExportResult + from ._models_py3 import ResourceGroupFilter + from ._models_py3 import ResourceGroupListResult + from ._models_py3 import ResourceGroupPatchable + from ._models_py3 import ResourceGroupProperties + from ._models_py3 import ResourceListResult + from ._models_py3 import ResourceManagementErrorWithDetails + from ._models_py3 import ResourceProviderOperationDisplayProperties + from ._models_py3 import ResourcesMoveInfo + from ._models_py3 import Sku + from ._models_py3 import SubResource + from ._models_py3 import TagCount + from ._models_py3 import TagDetails + from ._models_py3 import TagValue + from ._models_py3 import TagsListResult + from ._models_py3 import TargetResource + from ._models_py3 import TemplateHashResult + from ._models_py3 import TemplateLink +except (SyntaxError, ImportError): + from ._models import AliasPathType # type: ignore + from ._models import AliasType # type: ignore + from ._models import BasicDependency # type: ignore + from ._models import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore + from ._models import DebugSetting # type: ignore + from ._models import Dependency # type: ignore + from ._models import Deployment # type: ignore + from ._models import DeploymentExportResult # type: ignore + from ._models import DeploymentExtended # type: ignore + from ._models import DeploymentExtendedFilter # type: ignore + from ._models import DeploymentListResult # type: ignore + from ._models import DeploymentOperation # type: ignore + from ._models import DeploymentOperationProperties # type: ignore + from ._models import DeploymentOperationsListResult # type: ignore + from ._models import DeploymentProperties # type: ignore + from ._models import DeploymentPropertiesExtended # type: ignore + from ._models import DeploymentValidateResult # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ExportTemplateRequest # type: ignore + from ._models import GenericResource # type: ignore + from ._models import GenericResourceExpanded # type: ignore + from ._models import GenericResourceFilter # type: ignore + from ._models import HttpMessage # type: ignore + from ._models import Identity # type: ignore + from ._models import OnErrorDeployment # type: ignore + from ._models import OnErrorDeploymentExtended # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import ParametersLink # type: ignore + from ._models import Plan # type: ignore + from ._models import Provider # type: ignore + from ._models import ProviderListResult # type: ignore + from ._models import ProviderResourceType # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceGroup # type: ignore + from ._models import ResourceGroupExportResult # type: ignore + from ._models import ResourceGroupFilter # type: ignore + from ._models import ResourceGroupListResult # type: ignore + from ._models import ResourceGroupPatchable # type: ignore + from ._models import ResourceGroupProperties # type: ignore + from ._models import ResourceListResult # type: ignore + from ._models import ResourceManagementErrorWithDetails # type: ignore + from ._models import ResourceProviderOperationDisplayProperties # type: ignore + from ._models import ResourcesMoveInfo # type: ignore + from ._models import Sku # type: ignore + from ._models import SubResource # type: ignore + from ._models import TagCount # type: ignore + from ._models import TagDetails # type: ignore + from ._models import TagValue # type: ignore + from ._models import TagsListResult # type: ignore + from ._models import TargetResource # type: ignore + from ._models import TemplateHashResult # type: ignore + from ._models import TemplateLink # type: ignore + +from ._resource_management_client_enums import ( + DeploymentMode, + OnErrorDeploymentType, + ResourceIdentityType, +) + +__all__ = [ + 'AliasPathType', + 'AliasType', + 'BasicDependency', + 'ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties', + 'DebugSetting', + 'Dependency', + 'Deployment', + 'DeploymentExportResult', + 'DeploymentExtended', + 'DeploymentExtendedFilter', + 'DeploymentListResult', + 'DeploymentOperation', + 'DeploymentOperationProperties', + 'DeploymentOperationsListResult', + 'DeploymentProperties', + 'DeploymentPropertiesExtended', + 'DeploymentValidateResult', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ExportTemplateRequest', + 'GenericResource', + 'GenericResourceExpanded', + 'GenericResourceFilter', + 'HttpMessage', + 'Identity', + 'OnErrorDeployment', + 'OnErrorDeploymentExtended', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'ParametersLink', + 'Plan', + 'Provider', + 'ProviderListResult', + 'ProviderResourceType', + 'Resource', + 'ResourceGroup', + 'ResourceGroupExportResult', + 'ResourceGroupFilter', + 'ResourceGroupListResult', + 'ResourceGroupPatchable', + 'ResourceGroupProperties', + 'ResourceListResult', + 'ResourceManagementErrorWithDetails', + 'ResourceProviderOperationDisplayProperties', + 'ResourcesMoveInfo', + 'Sku', + 'SubResource', + 'TagCount', + 'TagDetails', + 'TagValue', + 'TagsListResult', + 'TargetResource', + 'TemplateHashResult', + 'TemplateLink', + 'DeploymentMode', + 'OnErrorDeploymentType', + 'ResourceIdentityType', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models.py new file mode 100644 index 000000000000..2994ed6178eb --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models.py @@ -0,0 +1,1856 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class AliasPathType(msrest.serialization.Model): + """The type of the paths for alias. + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPathType, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.api_versions = kwargs.get('api_versions', None) + + +class AliasType(msrest.serialization.Model): + """The alias type. + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: list[~azure.mgmt.resource.resources.v2019_03_01.models.AliasPathType] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPathType]'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasType, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.paths = kwargs.get('paths', None) + + +class BasicDependency(msrest.serialization.Model): + """Deployment dependency information. + + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BasicDependency, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_type = kwargs.get('resource_type', None) + self.resource_name = kwargs.get('resource_name', None) + + +class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class DebugSetting(msrest.serialization.Model): + """DebugSetting. + + :param detail_level: Specifies the type of information to log for debugging. The permitted + values are none, requestContent, responseContent, or both requestContent and responseContent + separated by a comma. The default is none. When setting this value, carefully consider the type + of information you are passing in during deployment. By logging information about the request + or response, you could potentially expose sensitive data that is retrieved through the + deployment operations. + :type detail_level: str + """ + + _attribute_map = { + 'detail_level': {'key': 'detailLevel', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DebugSetting, self).__init__(**kwargs) + self.detail_level = kwargs.get('detail_level', None) + + +class Dependency(msrest.serialization.Model): + """Deployment dependency information. + + :param depends_on: The list of dependencies. + :type depends_on: list[~azure.mgmt.resource.resources.v2019_03_01.models.BasicDependency] + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[BasicDependency]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Dependency, self).__init__(**kwargs) + self.depends_on = kwargs.get('depends_on', None) + self.id = kwargs.get('id', None) + self.resource_type = kwargs.get('resource_type', None) + self.resource_name = kwargs.get('resource_name', None) + + +class Deployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Deployment, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.properties = kwargs['properties'] + + +class DeploymentExportResult(msrest.serialization.Model): + """The deployment export result. + + :param template: The template content. + :type template: object + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentExportResult, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + + +class DeploymentExtended(msrest.serialization.Model): + """Deployment information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :param location: the location of the deployment. + :type location: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentPropertiesExtended + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentExtended, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) + + +class DeploymentExtendedFilter(msrest.serialization.Model): + """Deployment filter. + + :param provisioning_state: The provisioning state. + :type provisioning_state: str + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentExtendedFilter, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class DeploymentListResult(msrest.serialization.Model): + """List of deployments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployments. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentExtended]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DeploymentOperation(msrest.serialization.Model): + """Deployment operation information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full deployment operation ID. + :vartype id: str + :ivar operation_id: Deployment operation ID. + :vartype operation_id: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'operation_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentOperationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperation, self).__init__(**kwargs) + self.id = None + self.operation_id = None + self.properties = kwargs.get('properties', None) + + +class DeploymentOperationProperties(msrest.serialization.Model): + """Deployment operation properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar timestamp: The date and time of the operation. + :vartype timestamp: ~datetime.datetime + :ivar service_request_id: Deployment operation service request id. + :vartype service_request_id: str + :ivar status_code: Operation status code. + :vartype status_code: str + :ivar status_message: Operation status message. + :vartype status_message: object + :ivar target_resource: The target resource. + :vartype target_resource: ~azure.mgmt.resource.resources.v2019_03_01.models.TargetResource + :ivar request: The HTTP request message. + :vartype request: ~azure.mgmt.resource.resources.v2019_03_01.models.HttpMessage + :ivar response: The HTTP response message. + :vartype response: ~azure.mgmt.resource.resources.v2019_03_01.models.HttpMessage + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'service_request_id': {'readonly': True}, + 'status_code': {'readonly': True}, + 'status_message': {'readonly': True}, + 'target_resource': {'readonly': True}, + 'request': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'service_request_id': {'key': 'serviceRequestId', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'object'}, + 'target_resource': {'key': 'targetResource', 'type': 'TargetResource'}, + 'request': {'key': 'request', 'type': 'HttpMessage'}, + 'response': {'key': 'response', 'type': 'HttpMessage'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperationProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.timestamp = None + self.service_request_id = None + self.status_code = None + self.status_message = None + self.target_resource = None + self.request = None + self.response = None + + +class DeploymentOperationsListResult(msrest.serialization.Model): + """List of deployment operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployment operations. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperationsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DeploymentProperties(msrest.serialization.Model): + """Deployment properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2019_03_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2019_03_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2019_03_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2019_03_01.models.OnErrorDeployment + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentProperties, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + self.template_link = kwargs.get('template_link', None) + self.parameters = kwargs.get('parameters', None) + self.parameters_link = kwargs.get('parameters_link', None) + self.mode = kwargs['mode'] + self.debug_setting = kwargs.get('debug_setting', None) + self.on_error_deployment = kwargs.get('on_error_deployment', None) + + +class DeploymentPropertiesExtended(msrest.serialization.Model): + """Deployment properties with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar correlation_id: The correlation ID of the deployment. + :vartype correlation_id: str + :ivar timestamp: The timestamp of the template deployment. + :vartype timestamp: ~datetime.datetime + :param outputs: Key/value pairs that represent deployment output. + :type outputs: object + :param providers: The list of resource providers needed for the deployment. + :type providers: list[~azure.mgmt.resource.resources.v2019_03_01.models.Provider] + :param dependencies: The list of deployment dependencies. + :type dependencies: list[~azure.mgmt.resource.resources.v2019_03_01.models.Dependency] + :param template: The template content. Use only one of Template or TemplateLink. + :type template: object + :param template_link: The URI referencing the template. Use only one of Template or + TemplateLink. + :type template_link: ~azure.mgmt.resource.resources.v2019_03_01.models.TemplateLink + :param parameters: Deployment parameters. Use only one of Parameters or ParametersLink. + :type parameters: object + :param parameters_link: The URI referencing the parameters. Use only one of Parameters or + ParametersLink. + :type parameters_link: ~azure.mgmt.resource.resources.v2019_03_01.models.ParametersLink + :param mode: The deployment mode. Possible values are Incremental and Complete. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2019_03_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_03_01.models.OnErrorDeploymentExtended + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'timestamp': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'outputs': {'key': 'outputs', 'type': 'object'}, + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'dependencies': {'key': 'dependencies', 'type': '[Dependency]'}, + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeploymentExtended'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentPropertiesExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.correlation_id = None + self.timestamp = None + self.outputs = kwargs.get('outputs', None) + self.providers = kwargs.get('providers', None) + self.dependencies = kwargs.get('dependencies', None) + self.template = kwargs.get('template', None) + self.template_link = kwargs.get('template_link', None) + self.parameters = kwargs.get('parameters', None) + self.parameters_link = kwargs.get('parameters_link', None) + self.mode = kwargs.get('mode', None) + self.debug_setting = kwargs.get('debug_setting', None) + self.on_error_deployment = kwargs.get('on_error_deployment', None) + + +class DeploymentValidateResult(msrest.serialization.Model): + """Information from validate template deployment response. + + :param error: Validation error. + :type error: + ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceManagementErrorWithDetails + :param properties: The template deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentPropertiesExtended + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ResourceManagementErrorWithDetails'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentValidateResult, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + self.properties = kwargs.get('properties', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.resource.resources.v2019_03_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2019_03_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ExportTemplateRequest(msrest.serialization.Model): + """Export resource group template request parameters. + + :param resources: The IDs of the resources to filter the export by. To export all resources, + supply an array with single entry '*'. + :type resources: list[str] + :param options: The export template options. A CSV-formatted list containing zero or more of + the following: 'IncludeParameterDefaultValue', 'IncludeComments', + 'SkipResourceNameParameterization', 'SkipAllParameterization'. + :type options: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'options': {'key': 'options', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportTemplateRequest, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.options = kwargs.get('options', None) + + +class Resource(msrest.serialization.Model): + """Specified resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2019_03_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2019_03_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2019_03_01.models.Identity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + } + + def __init__( + self, + **kwargs + ): + super(GenericResource, self).__init__(**kwargs) + self.plan = kwargs.get('plan', None) + self.properties = kwargs.get('properties', None) + self.kind = kwargs.get('kind', None) + self.managed_by = kwargs.get('managed_by', None) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + + +class GenericResourceExpanded(GenericResource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2019_03_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2019_03_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2019_03_01.models.Identity + :ivar created_time: The created time of the resource. This is only present if requested via the + $expand query parameter. + :vartype created_time: ~datetime.datetime + :ivar changed_time: The changed time of the resource. This is only present if requested via the + $expand query parameter. + :vartype changed_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the resource. This is only present if + requested via the $expand query parameter. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'created_time': {'readonly': True}, + 'changed_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'changed_time': {'key': 'changedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GenericResourceExpanded, self).__init__(**kwargs) + self.created_time = None + self.changed_time = None + self.provisioning_state = None + + +class GenericResourceFilter(msrest.serialization.Model): + """Resource filter. + + :param resource_type: The resource type. + :type resource_type: str + :param tagname: The tag name. + :type tagname: str + :param tagvalue: The tag value. + :type tagvalue: str + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'tagname': {'key': 'tagname', 'type': 'str'}, + 'tagvalue': {'key': 'tagvalue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GenericResourceFilter, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.tagname = kwargs.get('tagname', None) + self.tagvalue = kwargs.get('tagvalue', None) + + +class HttpMessage(msrest.serialization.Model): + """HTTP message. + + :param content: HTTP message content. + :type content: object + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(HttpMessage, self).__init__(**kwargs) + self.content = kwargs.get('content', None) + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2019_03_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class OnErrorDeployment(msrest.serialization.Model): + """Deployment on error behavior. + + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2019_03_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OnErrorDeployment, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.deployment_name = kwargs.get('deployment_name', None) + + +class OnErrorDeploymentExtended(msrest.serialization.Model): + """Deployment on error behavior with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning for the on error deployment. + :vartype provisioning_state: str + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2019_03_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OnErrorDeploymentExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.type = kwargs.get('type', None) + self.deployment_name = kwargs.get('deployment_name', None) + + +class Operation(msrest.serialization.Model): + """Microsoft.Resources operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.resources.v2019_03_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Resources. + :type provider: str + :param resource: Resource on which the operation is performed: Profile, endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Resources operations. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ParametersLink(msrest.serialization.Model): + """Entity representing the reference to the deployment parameters. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the parameters file. + :type uri: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ParametersLink, self).__init__(**kwargs) + self.uri = kwargs['uri'] + self.content_version = kwargs.get('content_version', None) + + +class Plan(msrest.serialization.Model): + """Plan for the resource. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: The offer ID. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + :param version: The plan's version. + :type version: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.publisher = kwargs.get('publisher', None) + self.product = kwargs.get('product', None) + self.promotion_code = kwargs.get('promotion_code', None) + self.version = kwargs.get('version', None) + + +class Provider(msrest.serialization.Model): + """Resource provider information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The provider ID. + :vartype id: str + :param namespace: The namespace of the resource provider. + :type namespace: str + :ivar registration_state: The registration state of the resource provider. + :vartype registration_state: str + :ivar registration_policy: The registration policy of the resource provider. + :vartype registration_policy: str + :ivar resource_types: The collection of provider resource types. + :vartype resource_types: + list[~azure.mgmt.resource.resources.v2019_03_01.models.ProviderResourceType] + """ + + _validation = { + 'id': {'readonly': True}, + 'registration_state': {'readonly': True}, + 'registration_policy': {'readonly': True}, + 'resource_types': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'registration_policy': {'key': 'registrationPolicy', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ProviderResourceType]'}, + } + + def __init__( + self, + **kwargs + ): + super(Provider, self).__init__(**kwargs) + self.id = None + self.namespace = kwargs.get('namespace', None) + self.registration_state = None + self.registration_policy = None + self.resource_types = None + + +class ProviderListResult(msrest.serialization.Model): + """List of resource providers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource providers. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.Provider] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Provider]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ProviderResourceType(msrest.serialization.Model): + """Resource type managed by the resource provider. + + :param resource_type: The resource type. + :type resource_type: str + :param locations: The collection of locations where this resource type can be created. + :type locations: list[str] + :param aliases: The aliases that are supported by this resource type. + :type aliases: list[~azure.mgmt.resource.resources.v2019_03_01.models.AliasType] + :param api_versions: The API version. + :type api_versions: list[str] + :param capabilities: The additional capabilities offered by this resource type. + :type capabilities: str + :param properties: The properties. + :type properties: dict[str, str] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'aliases': {'key': 'aliases', 'type': '[AliasType]'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderResourceType, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.locations = kwargs.get('locations', None) + self.aliases = kwargs.get('aliases', None) + self.api_versions = kwargs.get('api_versions', None) + self.capabilities = kwargs.get('capabilities', None) + self.properties = kwargs.get('properties', None) + + +class ResourceGroup(msrest.serialization.Model): + """Resource group information. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the resource group. + :vartype id: str + :ivar name: The name of the resource group. + :vartype name: str + :ivar type: The type of the resource group. + :vartype type: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupProperties + :param location: Required. The location of the resource group. It cannot be changed after the + resource group has been created. It must be one of the supported Azure locations. + :type location: str + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroup, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + self.location = kwargs['location'] + self.managed_by = kwargs.get('managed_by', None) + self.tags = kwargs.get('tags', None) + + +class ResourceGroupExportResult(msrest.serialization.Model): + """Resource group export result. + + :param template: The template content. + :type template: object + :param error: The error. + :type error: + ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceManagementErrorWithDetails + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ResourceManagementErrorWithDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupExportResult, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + self.error = kwargs.get('error', None) + + +class ResourceGroupFilter(msrest.serialization.Model): + """Resource group filter. + + :param tag_name: The tag name. + :type tag_name: str + :param tag_value: The tag value. + :type tag_value: str + """ + + _attribute_map = { + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupFilter, self).__init__(**kwargs) + self.tag_name = kwargs.get('tag_name', None) + self.tag_value = kwargs.get('tag_value', None) + + +class ResourceGroupListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource groups. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ResourceGroupPatchable(msrest.serialization.Model): + """Resource group information. + + :param name: The name of the resource group. + :type name: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupProperties + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupPatchable, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + self.managed_by = kwargs.get('managed_by', None) + self.tags = kwargs.get('tags', None) + + +class ResourceGroupProperties(msrest.serialization.Model): + """The resource group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class ResourceListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resources. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResourceExpanded] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GenericResourceExpanded]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ResourceManagementErrorWithDetails(msrest.serialization.Model): + """The detailed error message of resource management. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code returned when exporting the template. + :vartype code: str + :ivar message: The error message describing the export error. + :vartype message: str + :ivar target: The target of the error. + :vartype target: str + :ivar details: Validation error. + :vartype details: + list[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceManagementErrorWithDetails] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ResourceManagementErrorWithDetails]'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceManagementErrorWithDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + + +class ResourceProviderOperationDisplayProperties(msrest.serialization.Model): + """Resource provider operation's display properties. + + :param publisher: Operation description. + :type publisher: str + :param provider: Operation provider. + :type provider: str + :param resource: Operation resource. + :type resource: str + :param operation: Resource provider operation. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationDisplayProperties, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class ResourcesMoveInfo(msrest.serialization.Model): + """Parameters of move resources. + + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourcesMoveInfo, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.target_resource_group = kwargs.get('target_resource_group', None) + + +class Sku(msrest.serialization.Model): + """SKU for the resource. + + :param name: The SKU name. + :type name: str + :param tier: The SKU tier. + :type tier: str + :param size: The SKU size. + :type size: str + :param family: The SKU family. + :type family: str + :param model: The SKU model. + :type model: str + :param capacity: The SKU capacity. + :type capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) + self.model = kwargs.get('model', None) + self.capacity = kwargs.get('capacity', None) + + +class SubResource(msrest.serialization.Model): + """Sub-resource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class TagCount(msrest.serialization.Model): + """Tag count. + + :param type: Type of count. + :type type: str + :param value: Value of count. + :type value: int + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(TagCount, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.value = kwargs.get('value', None) + + +class TagDetails(msrest.serialization.Model): + """Tag details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag ID. + :vartype id: str + :param tag_name: The tag name. + :type tag_name: str + :param count: The total number of resources that use the resource tag. When a tag is initially + created and has no associated resources, the value is 0. + :type count: ~azure.mgmt.resource.resources.v2019_03_01.models.TagCount + :param values: The list of tag values. + :type values: list[~azure.mgmt.resource.resources.v2019_03_01.models.TagValue] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + 'values': {'key': 'values', 'type': '[TagValue]'}, + } + + def __init__( + self, + **kwargs + ): + super(TagDetails, self).__init__(**kwargs) + self.id = None + self.tag_name = kwargs.get('tag_name', None) + self.count = kwargs.get('count', None) + self.values = kwargs.get('values', None) + + +class TagsListResult(msrest.serialization.Model): + """List of subscription tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of tags. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.TagDetails] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TagDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TagValue(msrest.serialization.Model): + """Tag information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag ID. + :vartype id: str + :param tag_value: The tag value. + :type tag_value: str + :param count: The tag value count. + :type count: ~azure.mgmt.resource.resources.v2019_03_01.models.TagCount + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + } + + def __init__( + self, + **kwargs + ): + super(TagValue, self).__init__(**kwargs) + self.id = None + self.tag_value = kwargs.get('tag_value', None) + self.count = kwargs.get('count', None) + + +class TargetResource(msrest.serialization.Model): + """Target resource. + + :param id: The ID of the resource. + :type id: str + :param resource_name: The name of the resource. + :type resource_name: str + :param resource_type: The type of the resource. + :type resource_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TargetResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_name = kwargs.get('resource_name', None) + self.resource_type = kwargs.get('resource_type', None) + + +class TemplateHashResult(msrest.serialization.Model): + """Result of the request to calculate template hash. It contains a string of minified template and its hash. + + :param minified_template: The minified template string. + :type minified_template: str + :param template_hash: The template hash. + :type template_hash: str + """ + + _attribute_map = { + 'minified_template': {'key': 'minifiedTemplate', 'type': 'str'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateHashResult, self).__init__(**kwargs) + self.minified_template = kwargs.get('minified_template', None) + self.template_hash = kwargs.get('template_hash', None) + + +class TemplateLink(msrest.serialization.Model): + """Entity representing the reference to the template. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the template to deploy. + :type uri: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateLink, self).__init__(**kwargs) + self.uri = kwargs['uri'] + self.content_version = kwargs.get('content_version', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py new file mode 100644 index 000000000000..476c7955932d --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py @@ -0,0 +1,2045 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._resource_management_client_enums import * + + +class AliasPathType(msrest.serialization.Model): + """The type of the paths for alias. + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + api_versions: Optional[List[str]] = None, + **kwargs + ): + super(AliasPathType, self).__init__(**kwargs) + self.path = path + self.api_versions = api_versions + + +class AliasType(msrest.serialization.Model): + """The alias type. + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: list[~azure.mgmt.resource.resources.v2019_03_01.models.AliasPathType] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPathType]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + paths: Optional[List["AliasPathType"]] = None, + **kwargs + ): + super(AliasType, self).__init__(**kwargs) + self.name = name + self.paths = paths + + +class BasicDependency(msrest.serialization.Model): + """Deployment dependency information. + + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + resource_type: Optional[str] = None, + resource_name: Optional[str] = None, + **kwargs + ): + super(BasicDependency, self).__init__(**kwargs) + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class DebugSetting(msrest.serialization.Model): + """DebugSetting. + + :param detail_level: Specifies the type of information to log for debugging. The permitted + values are none, requestContent, responseContent, or both requestContent and responseContent + separated by a comma. The default is none. When setting this value, carefully consider the type + of information you are passing in during deployment. By logging information about the request + or response, you could potentially expose sensitive data that is retrieved through the + deployment operations. + :type detail_level: str + """ + + _attribute_map = { + 'detail_level': {'key': 'detailLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + detail_level: Optional[str] = None, + **kwargs + ): + super(DebugSetting, self).__init__(**kwargs) + self.detail_level = detail_level + + +class Dependency(msrest.serialization.Model): + """Deployment dependency information. + + :param depends_on: The list of dependencies. + :type depends_on: list[~azure.mgmt.resource.resources.v2019_03_01.models.BasicDependency] + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[BasicDependency]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + *, + depends_on: Optional[List["BasicDependency"]] = None, + id: Optional[str] = None, + resource_type: Optional[str] = None, + resource_name: Optional[str] = None, + **kwargs + ): + super(Dependency, self).__init__(**kwargs) + self.depends_on = depends_on + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class Deployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + } + + def __init__( + self, + *, + properties: "DeploymentProperties", + location: Optional[str] = None, + **kwargs + ): + super(Deployment, self).__init__(**kwargs) + self.location = location + self.properties = properties + + +class DeploymentExportResult(msrest.serialization.Model): + """The deployment export result. + + :param template: The template content. + :type template: object + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__( + self, + *, + template: Optional[object] = None, + **kwargs + ): + super(DeploymentExportResult, self).__init__(**kwargs) + self.template = template + + +class DeploymentExtended(msrest.serialization.Model): + """Deployment information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :param location: the location of the deployment. + :type location: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentPropertiesExtended + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + properties: Optional["DeploymentPropertiesExtended"] = None, + **kwargs + ): + super(DeploymentExtended, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.properties = properties + + +class DeploymentExtendedFilter(msrest.serialization.Model): + """Deployment filter. + + :param provisioning_state: The provisioning state. + :type provisioning_state: str + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[str] = None, + **kwargs + ): + super(DeploymentExtendedFilter, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + + +class DeploymentListResult(msrest.serialization.Model): + """List of deployments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployments. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentExtended]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentExtended"]] = None, + **kwargs + ): + super(DeploymentListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeploymentOperation(msrest.serialization.Model): + """Deployment operation information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full deployment operation ID. + :vartype id: str + :ivar operation_id: Deployment operation ID. + :vartype operation_id: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'operation_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentOperationProperties'}, + } + + def __init__( + self, + *, + properties: Optional["DeploymentOperationProperties"] = None, + **kwargs + ): + super(DeploymentOperation, self).__init__(**kwargs) + self.id = None + self.operation_id = None + self.properties = properties + + +class DeploymentOperationProperties(msrest.serialization.Model): + """Deployment operation properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar timestamp: The date and time of the operation. + :vartype timestamp: ~datetime.datetime + :ivar service_request_id: Deployment operation service request id. + :vartype service_request_id: str + :ivar status_code: Operation status code. + :vartype status_code: str + :ivar status_message: Operation status message. + :vartype status_message: object + :ivar target_resource: The target resource. + :vartype target_resource: ~azure.mgmt.resource.resources.v2019_03_01.models.TargetResource + :ivar request: The HTTP request message. + :vartype request: ~azure.mgmt.resource.resources.v2019_03_01.models.HttpMessage + :ivar response: The HTTP response message. + :vartype response: ~azure.mgmt.resource.resources.v2019_03_01.models.HttpMessage + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'service_request_id': {'readonly': True}, + 'status_code': {'readonly': True}, + 'status_message': {'readonly': True}, + 'target_resource': {'readonly': True}, + 'request': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'service_request_id': {'key': 'serviceRequestId', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'object'}, + 'target_resource': {'key': 'targetResource', 'type': 'TargetResource'}, + 'request': {'key': 'request', 'type': 'HttpMessage'}, + 'response': {'key': 'response', 'type': 'HttpMessage'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperationProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.timestamp = None + self.service_request_id = None + self.status_code = None + self.status_message = None + self.target_resource = None + self.request = None + self.response = None + + +class DeploymentOperationsListResult(msrest.serialization.Model): + """List of deployment operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployment operations. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentOperation"]] = None, + **kwargs + ): + super(DeploymentOperationsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeploymentProperties(msrest.serialization.Model): + """Deployment properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2019_03_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2019_03_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2019_03_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2019_03_01.models.OnErrorDeployment + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + } + + def __init__( + self, + *, + mode: Union[str, "DeploymentMode"], + template: Optional[object] = None, + template_link: Optional["TemplateLink"] = None, + parameters: Optional[object] = None, + parameters_link: Optional["ParametersLink"] = None, + debug_setting: Optional["DebugSetting"] = None, + on_error_deployment: Optional["OnErrorDeployment"] = None, + **kwargs + ): + super(DeploymentProperties, self).__init__(**kwargs) + self.template = template + self.template_link = template_link + self.parameters = parameters + self.parameters_link = parameters_link + self.mode = mode + self.debug_setting = debug_setting + self.on_error_deployment = on_error_deployment + + +class DeploymentPropertiesExtended(msrest.serialization.Model): + """Deployment properties with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar correlation_id: The correlation ID of the deployment. + :vartype correlation_id: str + :ivar timestamp: The timestamp of the template deployment. + :vartype timestamp: ~datetime.datetime + :param outputs: Key/value pairs that represent deployment output. + :type outputs: object + :param providers: The list of resource providers needed for the deployment. + :type providers: list[~azure.mgmt.resource.resources.v2019_03_01.models.Provider] + :param dependencies: The list of deployment dependencies. + :type dependencies: list[~azure.mgmt.resource.resources.v2019_03_01.models.Dependency] + :param template: The template content. Use only one of Template or TemplateLink. + :type template: object + :param template_link: The URI referencing the template. Use only one of Template or + TemplateLink. + :type template_link: ~azure.mgmt.resource.resources.v2019_03_01.models.TemplateLink + :param parameters: Deployment parameters. Use only one of Parameters or ParametersLink. + :type parameters: object + :param parameters_link: The URI referencing the parameters. Use only one of Parameters or + ParametersLink. + :type parameters_link: ~azure.mgmt.resource.resources.v2019_03_01.models.ParametersLink + :param mode: The deployment mode. Possible values are Incremental and Complete. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2019_03_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_03_01.models.OnErrorDeploymentExtended + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'timestamp': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'outputs': {'key': 'outputs', 'type': 'object'}, + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'dependencies': {'key': 'dependencies', 'type': '[Dependency]'}, + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeploymentExtended'}, + } + + def __init__( + self, + *, + outputs: Optional[object] = None, + providers: Optional[List["Provider"]] = None, + dependencies: Optional[List["Dependency"]] = None, + template: Optional[object] = None, + template_link: Optional["TemplateLink"] = None, + parameters: Optional[object] = None, + parameters_link: Optional["ParametersLink"] = None, + mode: Optional[Union[str, "DeploymentMode"]] = None, + debug_setting: Optional["DebugSetting"] = None, + on_error_deployment: Optional["OnErrorDeploymentExtended"] = None, + **kwargs + ): + super(DeploymentPropertiesExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.correlation_id = None + self.timestamp = None + self.outputs = outputs + self.providers = providers + self.dependencies = dependencies + self.template = template + self.template_link = template_link + self.parameters = parameters + self.parameters_link = parameters_link + self.mode = mode + self.debug_setting = debug_setting + self.on_error_deployment = on_error_deployment + + +class DeploymentValidateResult(msrest.serialization.Model): + """Information from validate template deployment response. + + :param error: Validation error. + :type error: + ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceManagementErrorWithDetails + :param properties: The template deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentPropertiesExtended + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ResourceManagementErrorWithDetails'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__( + self, + *, + error: Optional["ResourceManagementErrorWithDetails"] = None, + properties: Optional["DeploymentPropertiesExtended"] = None, + **kwargs + ): + super(DeploymentValidateResult, self).__init__(**kwargs) + self.error = error + self.properties = properties + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.resource.resources.v2019_03_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2019_03_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ExportTemplateRequest(msrest.serialization.Model): + """Export resource group template request parameters. + + :param resources: The IDs of the resources to filter the export by. To export all resources, + supply an array with single entry '*'. + :type resources: list[str] + :param options: The export template options. A CSV-formatted list containing zero or more of + the following: 'IncludeParameterDefaultValue', 'IncludeComments', + 'SkipResourceNameParameterization', 'SkipAllParameterization'. + :type options: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'options': {'key': 'options', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[List[str]] = None, + options: Optional[str] = None, + **kwargs + ): + super(ExportTemplateRequest, self).__init__(**kwargs) + self.resources = resources + self.options = options + + +class Resource(msrest.serialization.Model): + """Specified resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2019_03_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2019_03_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2019_03_01.models.Identity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + properties: Optional[object] = None, + kind: Optional[str] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + identity: Optional["Identity"] = None, + **kwargs + ): + super(GenericResource, self).__init__(location=location, tags=tags, **kwargs) + self.plan = plan + self.properties = properties + self.kind = kind + self.managed_by = managed_by + self.sku = sku + self.identity = identity + + +class GenericResourceExpanded(GenericResource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2019_03_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2019_03_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2019_03_01.models.Identity + :ivar created_time: The created time of the resource. This is only present if requested via the + $expand query parameter. + :vartype created_time: ~datetime.datetime + :ivar changed_time: The changed time of the resource. This is only present if requested via the + $expand query parameter. + :vartype changed_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the resource. This is only present if + requested via the $expand query parameter. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'created_time': {'readonly': True}, + 'changed_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'changed_time': {'key': 'changedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + properties: Optional[object] = None, + kind: Optional[str] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + identity: Optional["Identity"] = None, + **kwargs + ): + super(GenericResourceExpanded, self).__init__(location=location, tags=tags, plan=plan, properties=properties, kind=kind, managed_by=managed_by, sku=sku, identity=identity, **kwargs) + self.created_time = None + self.changed_time = None + self.provisioning_state = None + + +class GenericResourceFilter(msrest.serialization.Model): + """Resource filter. + + :param resource_type: The resource type. + :type resource_type: str + :param tagname: The tag name. + :type tagname: str + :param tagvalue: The tag value. + :type tagvalue: str + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'tagname': {'key': 'tagname', 'type': 'str'}, + 'tagvalue': {'key': 'tagvalue', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + tagname: Optional[str] = None, + tagvalue: Optional[str] = None, + **kwargs + ): + super(GenericResourceFilter, self).__init__(**kwargs) + self.resource_type = resource_type + self.tagname = tagname + self.tagvalue = tagvalue + + +class HttpMessage(msrest.serialization.Model): + """HTTP message. + + :param content: HTTP message content. + :type content: object + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__( + self, + *, + content: Optional[object] = None, + **kwargs + ): + super(HttpMessage, self).__init__(**kwargs) + self.content = content + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2019_03_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class OnErrorDeployment(msrest.serialization.Model): + """Deployment on error behavior. + + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2019_03_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "OnErrorDeploymentType"]] = None, + deployment_name: Optional[str] = None, + **kwargs + ): + super(OnErrorDeployment, self).__init__(**kwargs) + self.type = type + self.deployment_name = deployment_name + + +class OnErrorDeploymentExtended(msrest.serialization.Model): + """Deployment on error behavior with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning for the on error deployment. + :vartype provisioning_state: str + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2019_03_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "OnErrorDeploymentType"]] = None, + deployment_name: Optional[str] = None, + **kwargs + ): + super(OnErrorDeploymentExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.type = type + self.deployment_name = deployment_name + + +class Operation(msrest.serialization.Model): + """Microsoft.Resources operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.resources.v2019_03_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Resources. + :type provider: str + :param resource: Resource on which the operation is performed: Profile, endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Resources operations. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ParametersLink(msrest.serialization.Model): + """Entity representing the reference to the deployment parameters. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the parameters file. + :type uri: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: str, + content_version: Optional[str] = None, + **kwargs + ): + super(ParametersLink, self).__init__(**kwargs) + self.uri = uri + self.content_version = content_version + + +class Plan(msrest.serialization.Model): + """Plan for the resource. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: The offer ID. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + :param version: The plan's version. + :type version: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class Provider(msrest.serialization.Model): + """Resource provider information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The provider ID. + :vartype id: str + :param namespace: The namespace of the resource provider. + :type namespace: str + :ivar registration_state: The registration state of the resource provider. + :vartype registration_state: str + :ivar registration_policy: The registration policy of the resource provider. + :vartype registration_policy: str + :ivar resource_types: The collection of provider resource types. + :vartype resource_types: + list[~azure.mgmt.resource.resources.v2019_03_01.models.ProviderResourceType] + """ + + _validation = { + 'id': {'readonly': True}, + 'registration_state': {'readonly': True}, + 'registration_policy': {'readonly': True}, + 'resource_types': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'registration_policy': {'key': 'registrationPolicy', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ProviderResourceType]'}, + } + + def __init__( + self, + *, + namespace: Optional[str] = None, + **kwargs + ): + super(Provider, self).__init__(**kwargs) + self.id = None + self.namespace = namespace + self.registration_state = None + self.registration_policy = None + self.resource_types = None + + +class ProviderListResult(msrest.serialization.Model): + """List of resource providers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource providers. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.Provider] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Provider]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Provider"]] = None, + **kwargs + ): + super(ProviderListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProviderResourceType(msrest.serialization.Model): + """Resource type managed by the resource provider. + + :param resource_type: The resource type. + :type resource_type: str + :param locations: The collection of locations where this resource type can be created. + :type locations: list[str] + :param aliases: The aliases that are supported by this resource type. + :type aliases: list[~azure.mgmt.resource.resources.v2019_03_01.models.AliasType] + :param api_versions: The API version. + :type api_versions: list[str] + :param capabilities: The additional capabilities offered by this resource type. + :type capabilities: str + :param properties: The properties. + :type properties: dict[str, str] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'aliases': {'key': 'aliases', 'type': '[AliasType]'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + locations: Optional[List[str]] = None, + aliases: Optional[List["AliasType"]] = None, + api_versions: Optional[List[str]] = None, + capabilities: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ProviderResourceType, self).__init__(**kwargs) + self.resource_type = resource_type + self.locations = locations + self.aliases = aliases + self.api_versions = api_versions + self.capabilities = capabilities + self.properties = properties + + +class ResourceGroup(msrest.serialization.Model): + """Resource group information. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the resource group. + :vartype id: str + :ivar name: The name of the resource group. + :vartype name: str + :ivar type: The type of the resource group. + :vartype type: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupProperties + :param location: Required. The location of the resource group. It cannot be changed after the + resource group has been created. It must be one of the supported Azure locations. + :type location: str + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + properties: Optional["ResourceGroupProperties"] = None, + managed_by: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceGroup, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + self.location = location + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupExportResult(msrest.serialization.Model): + """Resource group export result. + + :param template: The template content. + :type template: object + :param error: The error. + :type error: + ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceManagementErrorWithDetails + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ResourceManagementErrorWithDetails'}, + } + + def __init__( + self, + *, + template: Optional[object] = None, + error: Optional["ResourceManagementErrorWithDetails"] = None, + **kwargs + ): + super(ResourceGroupExportResult, self).__init__(**kwargs) + self.template = template + self.error = error + + +class ResourceGroupFilter(msrest.serialization.Model): + """Resource group filter. + + :param tag_name: The tag name. + :type tag_name: str + :param tag_value: The tag value. + :type tag_value: str + """ + + _attribute_map = { + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + } + + def __init__( + self, + *, + tag_name: Optional[str] = None, + tag_value: Optional[str] = None, + **kwargs + ): + super(ResourceGroupFilter, self).__init__(**kwargs) + self.tag_name = tag_name + self.tag_value = tag_value + + +class ResourceGroupListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource groups. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceGroup"]] = None, + **kwargs + ): + super(ResourceGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceGroupPatchable(msrest.serialization.Model): + """Resource group information. + + :param name: The name of the resource group. + :type name: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupProperties + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["ResourceGroupProperties"] = None, + managed_by: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceGroupPatchable, self).__init__(**kwargs) + self.name = name + self.properties = properties + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupProperties(msrest.serialization.Model): + """The resource group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class ResourceListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resources. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResourceExpanded] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GenericResourceExpanded]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["GenericResourceExpanded"]] = None, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceManagementErrorWithDetails(msrest.serialization.Model): + """The detailed error message of resource management. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code returned when exporting the template. + :vartype code: str + :ivar message: The error message describing the export error. + :vartype message: str + :ivar target: The target of the error. + :vartype target: str + :ivar details: Validation error. + :vartype details: + list[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceManagementErrorWithDetails] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ResourceManagementErrorWithDetails]'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceManagementErrorWithDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + + +class ResourceProviderOperationDisplayProperties(msrest.serialization.Model): + """Resource provider operation's display properties. + + :param publisher: Operation description. + :type publisher: str + :param provider: Operation provider. + :type provider: str + :param resource: Operation resource. + :type resource: str + :param operation: Resource provider operation. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(ResourceProviderOperationDisplayProperties, self).__init__(**kwargs) + self.publisher = publisher + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourcesMoveInfo(msrest.serialization.Model): + """Parameters of move resources. + + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[List[str]] = None, + target_resource_group: Optional[str] = None, + **kwargs + ): + super(ResourcesMoveInfo, self).__init__(**kwargs) + self.resources = resources + self.target_resource_group = target_resource_group + + +class Sku(msrest.serialization.Model): + """SKU for the resource. + + :param name: The SKU name. + :type name: str + :param tier: The SKU tier. + :type tier: str + :param size: The SKU size. + :type size: str + :param family: The SKU family. + :type family: str + :param model: The SKU model. + :type model: str + :param capacity: The SKU capacity. + :type capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + model: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.model = model + self.capacity = capacity + + +class SubResource(msrest.serialization.Model): + """Sub-resource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class TagCount(msrest.serialization.Model): + """Tag count. + + :param type: Type of count. + :type type: str + :param value: Value of count. + :type value: int + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + value: Optional[int] = None, + **kwargs + ): + super(TagCount, self).__init__(**kwargs) + self.type = type + self.value = value + + +class TagDetails(msrest.serialization.Model): + """Tag details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag ID. + :vartype id: str + :param tag_name: The tag name. + :type tag_name: str + :param count: The total number of resources that use the resource tag. When a tag is initially + created and has no associated resources, the value is 0. + :type count: ~azure.mgmt.resource.resources.v2019_03_01.models.TagCount + :param values: The list of tag values. + :type values: list[~azure.mgmt.resource.resources.v2019_03_01.models.TagValue] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + 'values': {'key': 'values', 'type': '[TagValue]'}, + } + + def __init__( + self, + *, + tag_name: Optional[str] = None, + count: Optional["TagCount"] = None, + values: Optional[List["TagValue"]] = None, + **kwargs + ): + super(TagDetails, self).__init__(**kwargs) + self.id = None + self.tag_name = tag_name + self.count = count + self.values = values + + +class TagsListResult(msrest.serialization.Model): + """List of subscription tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of tags. + :type value: list[~azure.mgmt.resource.resources.v2019_03_01.models.TagDetails] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TagDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TagDetails"]] = None, + **kwargs + ): + super(TagsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TagValue(msrest.serialization.Model): + """Tag information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag ID. + :vartype id: str + :param tag_value: The tag value. + :type tag_value: str + :param count: The tag value count. + :type count: ~azure.mgmt.resource.resources.v2019_03_01.models.TagCount + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + } + + def __init__( + self, + *, + tag_value: Optional[str] = None, + count: Optional["TagCount"] = None, + **kwargs + ): + super(TagValue, self).__init__(**kwargs) + self.id = None + self.tag_value = tag_value + self.count = count + + +class TargetResource(msrest.serialization.Model): + """Target resource. + + :param id: The ID of the resource. + :type id: str + :param resource_name: The name of the resource. + :type resource_name: str + :param resource_type: The type of the resource. + :type resource_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + resource_name: Optional[str] = None, + resource_type: Optional[str] = None, + **kwargs + ): + super(TargetResource, self).__init__(**kwargs) + self.id = id + self.resource_name = resource_name + self.resource_type = resource_type + + +class TemplateHashResult(msrest.serialization.Model): + """Result of the request to calculate template hash. It contains a string of minified template and its hash. + + :param minified_template: The minified template string. + :type minified_template: str + :param template_hash: The template hash. + :type template_hash: str + """ + + _attribute_map = { + 'minified_template': {'key': 'minifiedTemplate', 'type': 'str'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + } + + def __init__( + self, + *, + minified_template: Optional[str] = None, + template_hash: Optional[str] = None, + **kwargs + ): + super(TemplateHashResult, self).__init__(**kwargs) + self.minified_template = minified_template + self.template_hash = template_hash + + +class TemplateLink(msrest.serialization.Model): + """Entity representing the reference to the template. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the template to deploy. + :type uri: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: str, + content_version: Optional[str] = None, + **kwargs + ): + super(TemplateLink, self).__init__(**kwargs) + self.uri = uri + self.content_version = content_version diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_resource_management_client_enums.py new file mode 100644 index 000000000000..fb982486e0e9 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_resource_management_client_enums.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + +class DeploymentMode(str, Enum): + """The mode that is used to deploy resources. This value can be either Incremental or Complete. In + Incremental mode, resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and existing resources in + the resource group that are not included in the template are deleted. Be careful when using + Complete mode as you may unintentionally delete resources. + """ + + incremental = "Incremental" + complete = "Complete" + +class OnErrorDeploymentType(str, Enum): + """The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. + """ + + last_successful = "LastSuccessful" + specific_deployment = "SpecificDeployment" + +class ResourceIdentityType(str, Enum): + """The identity type. + """ + + system_assigned = "SystemAssigned" + user_assigned = "UserAssigned" + system_assigned_user_assigned = "SystemAssigned, UserAssigned" + none = "None" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/__init__.py new file mode 100644 index 000000000000..a6f5fa20e792 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._deployments_operations import DeploymentsOperations +from ._providers_operations import ProvidersOperations +from ._resources_operations import ResourcesOperations +from ._resource_groups_operations import ResourceGroupsOperations +from ._tags_operations import TagsOperations +from ._deployment_operations_operations import DeploymentOperationsOperations + +__all__ = [ + 'Operations', + 'DeploymentsOperations', + 'ProvidersOperations', + 'ResourcesOperations', + 'ResourceGroupsOperations', + 'TagsOperations', + 'DeploymentOperationsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployment_operations_operations.py new file mode 100644 index 000000000000..b89c83498675 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployment_operations_operations.py @@ -0,0 +1,312 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentOperationsOperations(object): + """DeploymentOperationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_at_subscription_scope( + self, + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentOperation" + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_subscription_scope( + self, + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment with the operation to get. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + def get( + self, + resource_group_name, # type: str + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentOperation" + """Gets a deployments operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment with the operation to get. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployments_operations.py new file mode 100644 index 000000000000..ededeefbe750 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployments_operations.py @@ -0,0 +1,1277 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations(object): + """DeploymentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_at_subscription_scope_initial( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment to delete. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_at_subscription_scope_initial( + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment to check. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_at_subscription_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update_at_subscription_scope( + self, + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentExtended"] + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + """Gets a deployment. + + :param deployment_name: The name of the deployment to get. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment to cancel. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.cancel_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def validate_at_subscription_scope( + self, + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentValidateResult" + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def export_template_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment from which to get the template. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.export_template_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_subscription_scope( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentListResult"] + """Get all the deployments for a subscription. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. Deleting a template deployment does + not affect the state of the resource group. This is an asynchronous operation that returns a + status of 202 until the template deployment is successfully deleted. The Location response + header contains the URI that is used to obtain the status of the process. While the process is + running, a call to the URI in the Location header returns a status of 202. When the process + finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param resource_group_name: The name of the resource group with the deployment to delete. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment to delete. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether the deployment exists. + + :param resource_group_name: The name of the resource group with the deployment to check. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment to check. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentExtended"] + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + """Gets a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment to get. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resource group + partially deployed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment to cancel. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.cancel.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def validate( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentValidateResult" + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.validate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def export_template( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment from which to get the template. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.export_template.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentListResult"] + """Get all the deployments for a resource group. + + :param resource_group_name: The name of the resource group with the deployments to get. The + name is case insensitive. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def calculate_template_hash( + self, + template, # type: object + **kwargs # type: Any + ): + # type: (...) -> "models.TemplateHashResult" + """Calculate the hash of the given template. + + :param template: The template provided to calculate hash. + :type template: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateHashResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TemplateHashResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.calculate_template_hash.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(template, 'object') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TemplateHashResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + calculate_template_hash.metadata = {'url': '/providers/Microsoft.Resources/calculateTemplateHash'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py new file mode 100644 index 000000000000..cb4e209c1e0b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationListResult"] + """Lists all of the available Microsoft.Resources REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Resources/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_providers_operations.py new file mode 100644 index 000000000000..b3efc1f54e18 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_providers_operations.py @@ -0,0 +1,284 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ProvidersOperations(object): + """ProvidersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def unregister( + self, + resource_provider_namespace, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Provider" + """Unregisters a subscription from a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to unregister. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.unregister.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + unregister.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister'} # type: ignore + + def register( + self, + resource_provider_namespace, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Provider" + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.register.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + register.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register'} # type: ignore + + def list( + self, + top=None, # type: Optional[int] + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProviderListResult"] + """Gets all resource providers for a subscription. + + :param top: The number of results to return. If null is passed returns all deployments. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers'} # type: ignore + + def get( + self, + resource_provider_namespace, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.Provider" + """Gets the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resource_groups_operations.py new file mode 100644 index 000000000000..43db1f2f9eb0 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resource_groups_operations.py @@ -0,0 +1,519 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourceGroupsOperations(object): + """ResourceGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_existence( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether a resource group exists. + + :param resource_group_name: The name of the resource group to check. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + parameters, # type: "models.ResourceGroup" + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceGroup" + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a resource group. + + When you delete a resource group, all of its resources are also deleted. Deleting a resource + group deletes all of its template deployments and currently stored operations. + + :param resource_group_name: The name of the resource group to delete. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceGroup" + """Gets a resource group. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + parameters, # type: "models.ResourceGroupPatchable" + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceGroup" + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def export_template( + self, + resource_group_name, # type: str + parameters, # type: "models.ExportTemplateRequest" + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceGroupExportResult" + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group to export as a template. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ExportTemplateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroupExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.export_template.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ExportTemplateRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceGroupListResult"] + """Gets all the resource groups for a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by + tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq + 'tag1' and tagValue eq 'Value1'. + :type filter: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resources_operations.py new file mode 100644 index 000000000000..f1ae2738e4ea --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resources_operations.py @@ -0,0 +1,1428 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourcesOperations(object): + """ResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + expand=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceListResult"] + """Get all the resources for a resource group. + + :param resource_group_name: The resource group with the resources to get. + :type resource_group_name: str + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1':code:`
`:code:`
`You can use some + properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resources. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources'} # type: ignore + + def _move_resources_initial( + self, + source_resource_group_name, # type: str + parameters, # type: "models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + def begin_move_resources( + self, + source_resource_group_name, # type: str + parameters, # type: "models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Moves resources from one resource group to another resource group. + + The resources to move must be in the same source resource group. The target resource group may + be in a different subscription. When moving resources, both the source group and the target + group are locked for the duration of the operation. Write and delete operations are blocked on + the groups until the move completes. + + :param source_resource_group_name: The name of the resource group containing the resources to + move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourcesMoveInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + def _validate_move_resources_initial( + self, + source_resource_group_name, # type: str + parameters, # type: "models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204, 409]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _validate_move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + def begin_validate_move_resources( + self, + source_resource_group_name, # type: str + parameters, # type: "models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to move must be in the same source resource group. The target resource group may be in a + different subscription. If validation succeeds, it returns HTTP response code 204 (no content). + If validation fails, it returns HTTP response code 409 (Conflict) with an error message. + Retrieve the URL in the Location header value to check the result of the long-running + operation. + + :param source_resource_group_name: The name of the resource group containing the resources to + validate for move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourcesMoveInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + expand=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceListResult"] + """Get all the resources in a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1':code:`
`:code:`
`You can use some + properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + + def check_existence( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether a resource exists. + + :param resource_group_name: The name of the resource group containing the resource to check. + The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The resource provider of the resource to check. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to check whether it exists. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a resource. + + :param resource_group_name: The name of the resource group that contains the resource to + delete. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to delete. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.GenericResource"] + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. + :type resource_type: str + :param resource_name: The name of the resource to create. + :type resource_name: str + :param parameters: Parameters for creating or updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.GenericResource"] + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. + :type resource_type: str + :param resource_name: The name of the resource to update. + :type resource_name: str + :param parameters: Parameters for updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.GenericResource" + """Gets a resource. + + :param resource_group_name: The name of the resource group containing the resource to get. The + name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def check_existence_by_id( + self, + resource_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks by ID whether a resource exists. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.check_existence_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def _delete_by_id_initial( + self, + resource_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self._delete_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + def begin_delete_by_id( + self, + resource_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_by_id_initial( + resource_id=resource_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def _create_or_update_by_id_initial( + self, + resource_id, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + def begin_create_or_update_by_id( + self, + resource_id, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.GenericResource"] + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param parameters: Create or update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_by_id_initial( + resource_id=resource_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def _update_by_id_initial( + self, + resource_id, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + def begin_update_by_id( + self, + resource_id, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.GenericResource"] + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param parameters: Update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_by_id_initial( + resource_id=resource_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def get_by_id( + self, + resource_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.GenericResource" + """Gets a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.get_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_id.metadata = {'url': '/{resourceId}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_tags_operations.py new file mode 100644 index 000000000000..e776efa791f6 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_tags_operations.py @@ -0,0 +1,332 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TagsOperations(object): + """TagsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2019_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def delete_value( + self, + tag_name, # type: str + tag_value, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a tag value. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to delete. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.delete_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + def create_or_update_value( + self, + tag_name, # type: str + tag_value, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TagValue" + """Creates a tag value. The name of the tag must already exist. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to create. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagValue, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TagValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.create_or_update_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagValue', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + def create_or_update( + self, + tag_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TagDetails" + """Creates a tag in the subscription. + + The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by + Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these + prefixes. + + :param tag_name: The name of the tag to create. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagDetails, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TagDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + def delete( + self, + tag_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a tag from the subscription. + + You must remove all values from a resource tag before you can delete it. + + :param tag_name: The name of the tag. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TagsListResult"] + """Gets the names and values of all resource tags that are defined in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TagsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.TagsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-03-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('TagsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/py.typed b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_deployment_operations_operations_async.py index b7b2788b2988..8990fdeefdaf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_deployment_operations_operations_async.py @@ -83,7 +83,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -126,6 +125,10 @@ def list_at_management_group_scope( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -140,15 +143,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -214,7 +213,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,6 +252,10 @@ def list_at_subscription_scope( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -268,15 +270,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -346,7 +344,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -389,6 +386,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -404,15 +405,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_deployments_operations_async.py index 6560fff90b22..c2009bdedd97 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_deployments_operations_async.py @@ -69,7 +69,6 @@ async def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -88,7 +87,7 @@ async def begin_delete_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -109,8 +108,8 @@ async def begin_delete_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -186,7 +185,6 @@ async def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,7 +229,6 @@ async def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -244,7 +241,6 @@ async def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -263,7 +259,7 @@ async def begin_create_or_update_at_management_group_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -280,8 +276,8 @@ async def begin_create_or_update_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -362,7 +358,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -421,7 +416,6 @@ async def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,7 +473,6 @@ async def validate_at_management_group_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -492,7 +485,6 @@ async def validate_at_management_group_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -543,7 +535,6 @@ async def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -587,6 +578,10 @@ def list_at_management_group_scope( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -602,15 +597,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -662,7 +653,6 @@ async def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -680,7 +670,7 @@ async def begin_delete_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -699,8 +689,8 @@ async def begin_delete_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -772,7 +762,6 @@ async def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -816,7 +805,6 @@ async def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -829,7 +817,6 @@ async def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -847,7 +834,7 @@ async def begin_create_or_update_at_subscription_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -862,8 +849,8 @@ async def begin_create_or_update_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -940,7 +927,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -996,7 +982,6 @@ async def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1051,7 +1036,6 @@ async def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1064,7 +1048,6 @@ async def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1112,7 +1095,6 @@ async def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1153,6 +1135,10 @@ def list_at_subscription_scope( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -1168,15 +1154,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1230,7 +1212,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1249,7 +1230,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1272,8 +1253,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1351,7 +1332,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1397,7 +1377,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1410,7 +1389,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1429,7 +1407,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -1447,8 +1425,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1530,7 +1508,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1590,7 +1567,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1650,7 +1626,6 @@ async def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1663,7 +1638,6 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1715,7 +1689,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1760,6 +1733,10 @@ def list_by_resource_group( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -1776,15 +1753,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1843,7 +1816,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_operations_async.py index f13a138768fd..82ca43766454 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_providers_operations_async.py index a588259f39cd..b180d8490287 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,6 +168,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +187,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -261,7 +259,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_resource_groups_operations_async.py index 81fc37ef0a8e..c4bb24593339 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_resource_groups_operations_async.py @@ -78,7 +78,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -135,7 +134,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -148,7 +146,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -186,7 +183,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -204,7 +200,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -219,8 +215,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -294,7 +290,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -356,7 +351,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -417,7 +411,6 @@ async def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -463,6 +456,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -478,15 +475,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_resources_operations_async.py index 4659aa5cf9b9..7935d32fb665 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_resources_operations_async.py @@ -86,6 +86,10 @@ def list_by_resource_group( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -104,15 +108,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -167,7 +167,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -190,7 +189,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -209,8 +208,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -277,7 +276,6 @@ async def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -300,7 +298,7 @@ async def begin_validate_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -321,8 +319,8 @@ async def begin_validate_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -401,6 +399,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -418,15 +420,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -504,7 +502,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -552,7 +549,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -574,7 +570,7 @@ async def begin_delete( resource_type: str, resource_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -594,8 +590,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -646,8 +642,8 @@ async def _create_or_update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-01" @@ -674,7 +670,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -709,7 +704,7 @@ async def begin_create_or_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -731,8 +726,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -787,8 +782,8 @@ async def _update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-01" @@ -815,7 +810,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -847,7 +841,7 @@ async def begin_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -869,8 +863,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -968,7 +962,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1020,7 +1013,6 @@ async def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1059,7 +1051,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1077,7 +1068,7 @@ async def begin_delete_by_id( self, resource_id: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1090,8 +1081,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1134,8 +1125,8 @@ async def _create_or_update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-01" @@ -1157,7 +1148,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1188,7 +1178,7 @@ async def begin_create_or_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1203,8 +1193,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1251,8 +1241,8 @@ async def _update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-01" @@ -1274,7 +1264,6 @@ async def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1302,7 +1291,7 @@ async def begin_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1317,8 +1306,8 @@ async def begin_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1396,7 +1385,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_tags_operations_async.py index 76ac8cb9bcfa..c99fc61a2f11 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations_async/_tags_operations_async.py @@ -79,7 +79,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,7 +131,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +139,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -193,7 +190,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -251,7 +246,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,6 +276,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -293,15 +291,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployment_operations_operations.py index 68228731b42b..793757d79085 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployment_operations_operations.py @@ -88,7 +88,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,6 +131,10 @@ def list_at_management_group_scope( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -146,15 +149,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -221,7 +220,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,6 +260,10 @@ def list_at_subscription_scope( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -276,15 +278,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -355,7 +353,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -399,6 +396,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -414,15 +415,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployments_operations.py index 94a934c22033..20902977fc3a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployments_operations.py @@ -74,7 +74,6 @@ def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,7 +93,7 @@ def begin_delete_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -193,7 +192,6 @@ def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,7 +237,6 @@ def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -252,7 +249,6 @@ def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -272,7 +268,7 @@ def begin_create_or_update_at_management_group_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -372,7 +368,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -432,7 +427,6 @@ def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -491,7 +485,6 @@ def validate_at_management_group_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -504,7 +497,6 @@ def validate_at_management_group_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -556,7 +548,6 @@ def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -601,6 +592,10 @@ def list_at_management_group_scope( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -616,15 +611,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -677,7 +668,6 @@ def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -696,7 +686,7 @@ def begin_delete_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -789,7 +779,6 @@ def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -834,7 +823,6 @@ def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -847,7 +835,6 @@ def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -866,7 +853,7 @@ def begin_create_or_update_at_subscription_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -960,7 +947,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1017,7 +1003,6 @@ def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1073,7 +1058,6 @@ def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1086,7 +1070,6 @@ def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1135,7 +1118,6 @@ def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1177,6 +1159,10 @@ def list_at_subscription_scope( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -1192,15 +1178,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1255,7 +1237,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1275,7 +1256,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1378,7 +1359,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1425,7 +1405,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1438,7 +1417,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1458,7 +1436,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -1560,7 +1538,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1621,7 +1598,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1682,7 +1658,6 @@ def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1695,7 +1670,6 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1748,7 +1722,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1794,6 +1767,10 @@ def list_by_resource_group( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -1810,15 +1787,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1878,7 +1851,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py index ad5654db772a..9a3c657ee501 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_providers_operations.py index 4c6c30d5b10a..3f189c6bc87b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,6 +175,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +194,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -269,7 +267,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resource_groups_operations.py index dbdfcb5e4352..593196103745 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resource_groups_operations.py @@ -83,7 +83,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +140,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -154,7 +152,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -193,7 +190,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,7 +208,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -303,7 +299,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -366,7 +361,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -428,7 +422,6 @@ def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -475,6 +468,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -490,15 +487,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resources_operations.py index 89fc75008c83..ea14183c2801 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resources_operations.py @@ -91,6 +91,10 @@ def list_by_resource_group( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -109,15 +113,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -173,7 +173,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -197,7 +196,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -285,7 +284,6 @@ def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -309,7 +307,7 @@ def begin_validate_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -411,6 +409,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -428,15 +430,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -515,7 +513,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,7 +561,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -587,7 +583,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -660,8 +656,8 @@ def _create_or_update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-01" @@ -688,7 +684,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -724,7 +719,7 @@ def begin_create_or_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -803,8 +798,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-01" @@ -831,7 +826,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -864,7 +858,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -986,7 +980,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1039,7 +1032,6 @@ def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,7 +1071,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1098,7 +1089,7 @@ def begin_delete_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1156,8 +1147,8 @@ def _create_or_update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-01" @@ -1179,7 +1170,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1211,7 +1201,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1275,8 +1265,8 @@ def _update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-01" @@ -1298,7 +1288,6 @@ def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1327,7 +1316,7 @@ def begin_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1422,7 +1411,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_tags_operations.py index adb3e3e9a0bc..36873c4c001e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_tags_operations.py @@ -84,7 +84,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,7 +137,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -200,7 +197,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +205,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -259,7 +254,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +285,10 @@ def list( api_version = "2019-05-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +300,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_deployment_operations_operations_async.py index 635ed4a0495e..ed3ec796f7ef 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_deployment_operations_operations_async.py @@ -83,7 +83,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -126,6 +125,10 @@ def list_at_management_group_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -140,15 +143,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -214,7 +213,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,6 +252,10 @@ def list_at_subscription_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -268,15 +270,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -346,7 +344,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -389,6 +386,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -404,15 +405,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_deployments_operations_async.py index 3608c5bd68f5..e3447bf82c57 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_deployments_operations_async.py @@ -69,7 +69,6 @@ async def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -88,7 +87,7 @@ async def begin_delete_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -109,8 +108,8 @@ async def begin_delete_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -186,7 +185,6 @@ async def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,7 +229,6 @@ async def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -244,7 +241,6 @@ async def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -263,7 +259,7 @@ async def begin_create_or_update_at_management_group_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -280,8 +276,8 @@ async def begin_create_or_update_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -362,7 +358,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -421,7 +416,6 @@ async def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,7 +473,6 @@ async def validate_at_management_group_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -492,7 +485,6 @@ async def validate_at_management_group_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -543,7 +535,6 @@ async def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -587,6 +578,10 @@ def list_at_management_group_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -602,15 +597,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -662,7 +653,6 @@ async def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -680,7 +670,7 @@ async def begin_delete_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -699,8 +689,8 @@ async def begin_delete_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -772,7 +762,6 @@ async def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -816,7 +805,6 @@ async def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -829,7 +817,6 @@ async def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -847,7 +834,7 @@ async def begin_create_or_update_at_subscription_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -862,8 +849,8 @@ async def begin_create_or_update_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -940,7 +927,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -996,7 +982,6 @@ async def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1051,7 +1036,6 @@ async def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1064,7 +1048,6 @@ async def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1112,7 +1095,6 @@ async def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1153,6 +1135,10 @@ def list_at_subscription_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -1168,15 +1154,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1230,7 +1212,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1249,7 +1230,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1272,8 +1253,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1351,7 +1332,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1397,7 +1377,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1410,7 +1389,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1429,7 +1407,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -1447,8 +1425,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1530,7 +1508,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1590,7 +1567,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1650,7 +1626,6 @@ async def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1663,7 +1638,6 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1715,7 +1689,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1760,6 +1733,10 @@ def list_by_resource_group( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -1776,15 +1753,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1843,7 +1816,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_operations_async.py index 5aeab1152b43..f9c6f4fd8fc3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_providers_operations_async.py index 9a30e8069911..be2d955ea2dc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,6 +168,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +187,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -245,6 +243,10 @@ def list_at_tenant_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -256,15 +258,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -332,7 +330,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -389,7 +386,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_resource_groups_operations_async.py index c9afcab2972c..b0138d7ac12a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_resource_groups_operations_async.py @@ -78,7 +78,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -135,7 +134,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -148,7 +146,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -186,7 +183,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -204,7 +200,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -219,8 +215,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -294,7 +290,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -356,7 +351,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -417,7 +411,6 @@ async def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -463,6 +456,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -478,15 +475,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_resources_operations_async.py index db4c82af223c..4dffac3e7c56 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_resources_operations_async.py @@ -86,6 +86,10 @@ def list_by_resource_group( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -104,15 +108,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -167,7 +167,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -190,7 +189,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -209,8 +208,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -277,7 +276,6 @@ async def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -300,7 +298,7 @@ async def begin_validate_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -321,8 +319,8 @@ async def begin_validate_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -401,6 +399,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -418,15 +420,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -504,7 +502,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -552,7 +549,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -574,7 +570,7 @@ async def begin_delete( resource_type: str, resource_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -594,8 +590,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -646,8 +642,8 @@ async def _create_or_update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-10" @@ -674,7 +670,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -709,7 +704,7 @@ async def begin_create_or_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -731,8 +726,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -787,8 +782,8 @@ async def _update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-10" @@ -815,7 +810,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -847,7 +841,7 @@ async def begin_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -869,8 +863,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -968,7 +962,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1020,7 +1013,6 @@ async def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1059,7 +1051,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1077,7 +1068,7 @@ async def begin_delete_by_id( self, resource_id: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1090,8 +1081,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1134,8 +1125,8 @@ async def _create_or_update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-10" @@ -1157,7 +1148,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1188,7 +1178,7 @@ async def begin_create_or_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1203,8 +1193,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1251,8 +1241,8 @@ async def _update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-10" @@ -1274,7 +1264,6 @@ async def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1302,7 +1291,7 @@ async def begin_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1317,8 +1306,8 @@ async def begin_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1396,7 +1385,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_tags_operations_async.py index 9b2c215a282d..6d6432e85abc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations_async/_tags_operations_async.py @@ -79,7 +79,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,7 +131,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +139,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -193,7 +190,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -251,7 +246,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,6 +276,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -293,15 +291,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployment_operations_operations.py index d307aaa5612c..bb6c6aa0743a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployment_operations_operations.py @@ -88,7 +88,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,6 +131,10 @@ def list_at_management_group_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -146,15 +149,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -221,7 +220,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,6 +260,10 @@ def list_at_subscription_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -276,15 +278,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -355,7 +353,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -399,6 +396,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -414,15 +415,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployments_operations.py index 70bad8672b59..afaa3e6ffc69 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployments_operations.py @@ -74,7 +74,6 @@ def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,7 +93,7 @@ def begin_delete_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -193,7 +192,6 @@ def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,7 +237,6 @@ def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -252,7 +249,6 @@ def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -272,7 +268,7 @@ def begin_create_or_update_at_management_group_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -372,7 +368,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -432,7 +427,6 @@ def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -491,7 +485,6 @@ def validate_at_management_group_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -504,7 +497,6 @@ def validate_at_management_group_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -556,7 +548,6 @@ def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -601,6 +592,10 @@ def list_at_management_group_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -616,15 +611,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -677,7 +668,6 @@ def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -696,7 +686,7 @@ def begin_delete_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -789,7 +779,6 @@ def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -834,7 +823,6 @@ def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -847,7 +835,6 @@ def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -866,7 +853,7 @@ def begin_create_or_update_at_subscription_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -960,7 +947,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1017,7 +1003,6 @@ def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1073,7 +1058,6 @@ def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1086,7 +1070,6 @@ def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1135,7 +1118,6 @@ def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1177,6 +1159,10 @@ def list_at_subscription_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -1192,15 +1178,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1255,7 +1237,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1275,7 +1256,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1378,7 +1359,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1425,7 +1405,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1438,7 +1417,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1458,7 +1436,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -1560,7 +1538,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1621,7 +1598,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1682,7 +1658,6 @@ def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1695,7 +1670,6 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1748,7 +1722,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1794,6 +1767,10 @@ def list_by_resource_group( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -1810,15 +1787,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1878,7 +1851,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py index 42273748759e..c00f3ea5722b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py index 076284ef0cd8..9afed68f9c48 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,6 +175,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +194,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -253,6 +251,10 @@ def list_at_tenant_scope( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -264,15 +266,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -341,7 +339,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -399,7 +396,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resource_groups_operations.py index 542ba6822bbb..7746ac1153e8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resource_groups_operations.py @@ -83,7 +83,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +140,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -154,7 +152,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -193,7 +190,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,7 +208,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -303,7 +299,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -366,7 +361,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -428,7 +422,6 @@ def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -475,6 +468,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -490,15 +487,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resources_operations.py index 5b2edc783238..9030ccb2cddb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resources_operations.py @@ -91,6 +91,10 @@ def list_by_resource_group( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -109,15 +113,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -173,7 +173,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -197,7 +196,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -285,7 +284,6 @@ def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -309,7 +307,7 @@ def begin_validate_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -411,6 +409,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -428,15 +430,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -515,7 +513,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,7 +561,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -587,7 +583,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -660,8 +656,8 @@ def _create_or_update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-10" @@ -688,7 +684,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -724,7 +719,7 @@ def begin_create_or_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -803,8 +798,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-10" @@ -831,7 +826,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -864,7 +858,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -986,7 +980,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1039,7 +1032,6 @@ def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,7 +1071,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1098,7 +1089,7 @@ def begin_delete_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1156,8 +1147,8 @@ def _create_or_update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-10" @@ -1179,7 +1170,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1211,7 +1201,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1275,8 +1265,8 @@ def _update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-05-10" @@ -1298,7 +1288,6 @@ def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1327,7 +1316,7 @@ def begin_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1422,7 +1411,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_tags_operations.py index 2355f519cb03..6ac0447f8fb4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_tags_operations.py @@ -84,7 +84,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,7 +137,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -200,7 +197,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +205,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -259,7 +254,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +285,10 @@ def list( api_version = "2019-05-10" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +300,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_deployment_operations_operations_async.py index 74f2e65f93a3..2076538eeb2d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_deployment_operations_operations_async.py @@ -83,7 +83,6 @@ async def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -126,6 +125,10 @@ def list_at_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -140,15 +143,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -213,7 +212,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,6 +251,10 @@ def list_at_tenant_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -266,15 +268,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -343,7 +341,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -386,6 +383,10 @@ def list_at_management_group_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -400,15 +401,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -474,7 +471,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,6 +510,10 @@ def list_at_subscription_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -528,15 +528,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -606,7 +602,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -649,6 +644,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -664,15 +663,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_deployments_operations_async.py index e642d45d231b..e5f2ad2f9679 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_deployments_operations_async.py @@ -69,7 +69,6 @@ async def _delete_at_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -88,7 +87,7 @@ async def begin_delete_at_scope( scope: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -109,8 +108,8 @@ async def begin_delete_at_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -186,7 +185,6 @@ async def check_existence_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,7 +229,6 @@ async def _create_or_update_at_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -244,7 +241,6 @@ async def _create_or_update_at_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -263,7 +259,7 @@ async def begin_create_or_update_at_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -280,8 +276,8 @@ async def begin_create_or_update_at_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -362,7 +358,6 @@ async def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -421,7 +416,6 @@ async def cancel_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,7 +473,6 @@ async def validate_at_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -492,7 +485,6 @@ async def validate_at_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -543,7 +535,6 @@ async def export_template_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -587,6 +578,10 @@ def list_at_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -602,15 +597,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -661,7 +652,6 @@ async def _delete_at_tenant_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -679,7 +669,7 @@ async def begin_delete_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -698,8 +688,8 @@ async def begin_delete_at_tenant_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -770,7 +760,6 @@ async def check_existence_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -813,7 +802,6 @@ async def _create_or_update_at_tenant_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -826,7 +814,6 @@ async def _create_or_update_at_tenant_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -844,7 +831,7 @@ async def begin_create_or_update_at_tenant_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -859,8 +846,8 @@ async def begin_create_or_update_at_tenant_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -936,7 +923,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -991,7 +977,6 @@ async def cancel_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1045,7 +1030,6 @@ async def validate_at_tenant_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1058,7 +1042,6 @@ async def validate_at_tenant_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1105,7 +1088,6 @@ async def export_template_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1146,6 +1128,10 @@ def list_at_tenant_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -1157,15 +1143,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1218,7 +1200,6 @@ async def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1237,7 +1218,7 @@ async def begin_delete_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1258,8 +1239,8 @@ async def begin_delete_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1335,7 +1316,6 @@ async def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1380,7 +1360,6 @@ async def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1393,7 +1372,6 @@ async def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1412,7 +1390,7 @@ async def begin_create_or_update_at_management_group_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1429,8 +1407,8 @@ async def begin_create_or_update_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1511,7 +1489,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1570,7 +1547,6 @@ async def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1628,7 +1604,6 @@ async def validate_at_management_group_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1641,7 +1616,6 @@ async def validate_at_management_group_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1692,7 +1666,6 @@ async def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1736,6 +1709,10 @@ def list_at_management_group_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -1751,15 +1728,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1811,7 +1784,6 @@ async def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1829,7 +1801,7 @@ async def begin_delete_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1848,8 +1820,8 @@ async def begin_delete_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1921,7 +1893,6 @@ async def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1965,7 +1936,6 @@ async def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1978,7 +1948,6 @@ async def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1996,7 +1965,7 @@ async def begin_create_or_update_at_subscription_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2011,8 +1980,8 @@ async def begin_create_or_update_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2089,7 +2058,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2145,7 +2113,6 @@ async def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2200,7 +2167,6 @@ async def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2213,7 +2179,6 @@ async def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -2231,8 +2196,8 @@ async def _what_if_at_subscription_scope_initial( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -2255,7 +2220,6 @@ async def _what_if_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -2288,7 +2252,7 @@ async def begin_what_if_at_subscription_scope( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2302,8 +2266,8 @@ async def begin_what_if_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: WhatIfOperationResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfOperationResult + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2380,7 +2344,6 @@ async def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2421,6 +2384,10 @@ def list_at_subscription_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -2436,15 +2403,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -2498,7 +2461,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2517,7 +2479,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -2540,8 +2502,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2619,7 +2581,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2665,7 +2626,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2678,7 +2638,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2697,7 +2656,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -2715,8 +2674,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2798,7 +2757,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2858,7 +2816,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2918,7 +2875,6 @@ async def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2931,7 +2887,6 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -2950,8 +2905,8 @@ async def _what_if_initial( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -2975,7 +2930,6 @@ async def _what_if_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -3009,7 +2963,7 @@ async def begin_what_if( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3026,8 +2980,8 @@ async def begin_what_if( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: WhatIfOperationResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfOperationResult + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3109,7 +3063,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3154,6 +3107,10 @@ def list_by_resource_group( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -3170,15 +3127,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -3237,7 +3190,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_operations_async.py index bad2c1ff45aa..f476258e6a4e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_providers_operations_async.py index d5c1ddc77ef9..0d2be110f1bd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,6 +168,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +187,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -245,6 +243,10 @@ def list_at_tenant_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -256,15 +258,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -332,7 +330,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -389,7 +386,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_resource_groups_operations_async.py index 5e36656c2472..c6b3dfa33f52 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_resource_groups_operations_async.py @@ -78,7 +78,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -135,7 +134,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -148,7 +146,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -186,7 +183,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -204,7 +200,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -219,8 +215,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -294,7 +290,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -356,7 +351,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -417,7 +411,6 @@ async def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -463,6 +456,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -478,15 +475,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_resources_operations_async.py index 86b9a95cc7bc..eb52937c2888 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_resources_operations_async.py @@ -86,6 +86,10 @@ def list_by_resource_group( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -104,15 +108,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -167,7 +167,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -190,7 +189,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -209,8 +208,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -277,7 +276,6 @@ async def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -300,7 +298,7 @@ async def begin_validate_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -321,8 +319,8 @@ async def begin_validate_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -401,6 +399,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -418,15 +420,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -504,7 +502,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -552,7 +549,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -574,7 +570,7 @@ async def begin_delete( resource_type: str, resource_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -594,8 +590,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -646,8 +642,8 @@ async def _create_or_update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -674,7 +670,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -709,7 +704,7 @@ async def begin_create_or_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -731,8 +726,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -787,8 +782,8 @@ async def _update_initial( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -815,7 +810,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -847,7 +841,7 @@ async def begin_update( resource_name: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -869,8 +863,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -968,7 +962,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1020,7 +1013,6 @@ async def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1059,7 +1051,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1077,7 +1068,7 @@ async def begin_delete_by_id( self, resource_id: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1090,8 +1081,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1134,8 +1125,8 @@ async def _create_or_update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -1157,7 +1148,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1188,7 +1178,7 @@ async def begin_create_or_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1203,8 +1193,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1251,8 +1241,8 @@ async def _update_by_id_initial( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -1274,7 +1264,6 @@ async def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1302,7 +1291,7 @@ async def begin_update_by_id( resource_id: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1317,8 +1306,8 @@ async def begin_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1396,7 +1385,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_tags_operations_async.py index af74edd51de3..6325349b43c8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations_async/_tags_operations_async.py @@ -79,7 +79,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,7 +131,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +139,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -193,7 +190,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -251,7 +246,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,6 +276,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -293,15 +291,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations_operations.py index a1facbb42e07..6447a18625dd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations_operations.py @@ -88,7 +88,6 @@ def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,6 +131,10 @@ def list_at_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -146,15 +149,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -220,7 +219,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -261,6 +259,10 @@ def list_at_tenant_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -274,15 +276,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -352,7 +350,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,6 +393,10 @@ def list_at_management_group_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -410,15 +411,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -485,7 +482,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,6 +522,10 @@ def list_at_subscription_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -540,15 +540,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -619,7 +615,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -663,6 +658,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -678,15 +677,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py index f2a659a7c455..b00c6ababa14 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py @@ -74,7 +74,6 @@ def _delete_at_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,7 +93,7 @@ def begin_delete_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -193,7 +192,6 @@ def check_existence_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,7 +237,6 @@ def _create_or_update_at_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -252,7 +249,6 @@ def _create_or_update_at_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -272,7 +268,7 @@ def begin_create_or_update_at_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -372,7 +368,6 @@ def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -432,7 +427,6 @@ def cancel_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -491,7 +485,6 @@ def validate_at_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -504,7 +497,6 @@ def validate_at_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -556,7 +548,6 @@ def export_template_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -601,6 +592,10 @@ def list_at_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -616,15 +611,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -676,7 +667,6 @@ def _delete_at_tenant_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -695,7 +685,7 @@ def begin_delete_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -787,7 +777,6 @@ def check_existence_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -831,7 +820,6 @@ def _create_or_update_at_tenant_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -844,7 +832,6 @@ def _create_or_update_at_tenant_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -863,7 +850,7 @@ def begin_create_or_update_at_tenant_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -956,7 +943,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1012,7 +998,6 @@ def cancel_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1067,7 +1052,6 @@ def validate_at_tenant_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1080,7 +1064,6 @@ def validate_at_tenant_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1128,7 +1111,6 @@ def export_template_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1170,6 +1152,10 @@ def list_at_tenant_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -1181,15 +1167,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1243,7 +1225,6 @@ def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1263,7 +1244,7 @@ def begin_delete_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1362,7 +1343,6 @@ def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1408,7 +1388,6 @@ def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1421,7 +1400,6 @@ def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1441,7 +1419,7 @@ def begin_create_or_update_at_management_group_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1541,7 +1519,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1601,7 +1578,6 @@ def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1660,7 +1636,6 @@ def validate_at_management_group_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1673,7 +1648,6 @@ def validate_at_management_group_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1725,7 +1699,6 @@ def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1770,6 +1743,10 @@ def list_at_management_group_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -1785,15 +1762,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1846,7 +1819,6 @@ def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1865,7 +1837,7 @@ def begin_delete_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1958,7 +1930,6 @@ def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2003,7 +1974,6 @@ def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2016,7 +1986,6 @@ def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2035,7 +2004,7 @@ def begin_create_or_update_at_subscription_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2129,7 +2098,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2186,7 +2154,6 @@ def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2242,7 +2209,6 @@ def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2255,7 +2221,6 @@ def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -2274,8 +2239,8 @@ def _what_if_at_subscription_scope_initial( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> "models.WhatIfOperationResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -2298,7 +2263,6 @@ def _what_if_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -2332,7 +2296,7 @@ def begin_what_if_at_subscription_scope( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2425,7 +2389,6 @@ def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2467,6 +2430,10 @@ def list_at_subscription_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -2482,15 +2449,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -2545,7 +2508,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2565,7 +2527,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -2668,7 +2630,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2715,7 +2676,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2728,7 +2688,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2748,7 +2707,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -2850,7 +2809,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2911,7 +2869,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2972,7 +2929,6 @@ def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2985,7 +2941,6 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -3005,8 +2960,8 @@ def _what_if_initial( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> "models.WhatIfOperationResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -3030,7 +2985,6 @@ def _what_if_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -3065,7 +3019,7 @@ def begin_what_if( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3166,7 +3120,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3212,6 +3165,10 @@ def list_by_resource_group( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -3228,15 +3185,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -3296,7 +3249,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py index 813ae21e3066..fe60b6c4fb66 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py index 185e9f591329..2dfe3ffcbd62 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,6 +175,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +194,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -253,6 +251,10 @@ def list_at_tenant_scope( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -264,15 +266,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -341,7 +339,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -399,7 +396,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py index fe3cc2b9c7e5..51c9817c66b4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py @@ -83,7 +83,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +140,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -154,7 +152,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -193,7 +190,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,7 +208,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -303,7 +299,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -366,7 +361,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -428,7 +422,6 @@ def export_template( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -475,6 +468,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -490,15 +487,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py index 201954c64c1d..718702797549 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py @@ -91,6 +91,10 @@ def list_by_resource_group( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -109,15 +113,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -173,7 +173,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -197,7 +196,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -285,7 +284,6 @@ def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -309,7 +307,7 @@ def begin_validate_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -411,6 +409,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -428,15 +430,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -515,7 +513,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,7 +561,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -587,7 +583,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -660,8 +656,8 @@ def _create_or_update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -688,7 +684,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -724,7 +719,7 @@ def begin_create_or_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -803,8 +798,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -831,7 +826,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -864,7 +858,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -986,7 +980,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1039,7 +1032,6 @@ def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,7 +1071,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1098,7 +1089,7 @@ def begin_delete_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1156,8 +1147,8 @@ def _create_or_update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -1179,7 +1170,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1211,7 +1201,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1275,8 +1265,8 @@ def _update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-07-01" @@ -1298,7 +1288,6 @@ def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1327,7 +1316,7 @@ def begin_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1422,7 +1411,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py index 023ed86f1a0c..a6e4318c439a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py @@ -84,7 +84,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,7 +137,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -200,7 +197,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +205,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -259,7 +254,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +285,10 @@ def list( api_version = "2019-07-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +300,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_deployment_operations_operations_async.py index c73fc4e5d865..7fb5e82d77f7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_deployment_operations_operations_async.py @@ -83,7 +83,6 @@ async def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -126,6 +125,10 @@ def list_at_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -140,15 +143,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -213,7 +212,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,6 +251,10 @@ def list_at_tenant_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -266,15 +268,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -343,7 +341,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -386,6 +383,10 @@ def list_at_management_group_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -400,15 +401,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -474,7 +471,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,6 +510,10 @@ def list_at_subscription_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -528,15 +528,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -606,7 +602,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -649,6 +644,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -664,15 +663,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_deployments_operations_async.py index 12f71b0f6124..4b7b20eea608 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_deployments_operations_async.py @@ -69,7 +69,6 @@ async def _delete_at_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -88,7 +87,7 @@ async def begin_delete_at_scope( scope: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -109,8 +108,8 @@ async def begin_delete_at_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -186,7 +185,6 @@ async def check_existence_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,7 +229,6 @@ async def _create_or_update_at_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -244,7 +241,6 @@ async def _create_or_update_at_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -263,7 +259,7 @@ async def begin_create_or_update_at_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -280,8 +276,8 @@ async def begin_create_or_update_at_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -362,7 +358,6 @@ async def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -421,7 +416,6 @@ async def cancel_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,7 +473,6 @@ async def validate_at_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -492,7 +485,6 @@ async def validate_at_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -543,7 +535,6 @@ async def export_template_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -587,6 +578,10 @@ def list_at_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -602,15 +597,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -661,7 +652,6 @@ async def _delete_at_tenant_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -679,7 +669,7 @@ async def begin_delete_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -698,8 +688,8 @@ async def begin_delete_at_tenant_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -770,7 +760,6 @@ async def check_existence_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -813,7 +802,6 @@ async def _create_or_update_at_tenant_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -826,7 +814,6 @@ async def _create_or_update_at_tenant_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -844,7 +831,7 @@ async def begin_create_or_update_at_tenant_scope( deployment_name: str, parameters: "models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -859,8 +846,8 @@ async def begin_create_or_update_at_tenant_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -936,7 +923,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -991,7 +977,6 @@ async def cancel_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1045,7 +1030,6 @@ async def validate_at_tenant_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1058,7 +1042,6 @@ async def validate_at_tenant_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1105,7 +1088,6 @@ async def export_template_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1146,6 +1128,10 @@ def list_at_tenant_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -1157,15 +1143,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1218,7 +1200,6 @@ async def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1237,7 +1218,7 @@ async def begin_delete_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1258,8 +1239,8 @@ async def begin_delete_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1335,7 +1316,6 @@ async def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1380,7 +1360,6 @@ async def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1393,7 +1372,6 @@ async def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1412,7 +1390,7 @@ async def begin_create_or_update_at_management_group_scope( deployment_name: str, parameters: "models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1429,8 +1407,8 @@ async def begin_create_or_update_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1511,7 +1489,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1570,7 +1547,6 @@ async def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1628,7 +1604,6 @@ async def validate_at_management_group_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1641,7 +1616,6 @@ async def validate_at_management_group_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1692,7 +1666,6 @@ async def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1736,6 +1709,10 @@ def list_at_management_group_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -1751,15 +1728,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1811,7 +1784,6 @@ async def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1829,7 +1801,7 @@ async def begin_delete_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1848,8 +1820,8 @@ async def begin_delete_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1921,7 +1893,6 @@ async def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1965,7 +1936,6 @@ async def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -1978,7 +1948,6 @@ async def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1996,7 +1965,7 @@ async def begin_create_or_update_at_subscription_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2011,8 +1980,8 @@ async def begin_create_or_update_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2089,7 +2058,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2145,7 +2113,6 @@ async def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2200,7 +2167,6 @@ async def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2213,7 +2179,6 @@ async def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -2231,8 +2196,8 @@ async def _what_if_at_subscription_scope_initial( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" @@ -2255,7 +2220,6 @@ async def _what_if_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -2288,7 +2252,7 @@ async def begin_what_if_at_subscription_scope( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2302,8 +2266,8 @@ async def begin_what_if_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: WhatIfOperationResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfOperationResult + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2380,7 +2344,6 @@ async def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2421,6 +2384,10 @@ def list_at_subscription_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -2436,15 +2403,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -2498,7 +2461,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2517,7 +2479,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -2540,8 +2502,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2619,7 +2581,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2665,7 +2626,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2678,7 +2638,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2697,7 +2656,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -2715,8 +2674,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2798,7 +2757,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2858,7 +2816,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2918,7 +2875,6 @@ async def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2931,7 +2887,6 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -2950,8 +2905,8 @@ async def _what_if_initial( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" @@ -2975,7 +2930,6 @@ async def _what_if_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -3009,7 +2963,7 @@ async def begin_what_if( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3026,8 +2980,8 @@ async def begin_what_if( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: WhatIfOperationResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfOperationResult + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3109,7 +3063,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3154,6 +3107,10 @@ def list_by_resource_group( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -3170,15 +3127,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -3237,7 +3190,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_operations_async.py index 1df24edfa8f3..6c2574e5ec99 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_providers_operations_async.py index 86458ffd3096..d39c23976c78 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,6 +168,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +187,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -245,6 +243,10 @@ def list_at_tenant_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -256,15 +258,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -332,7 +330,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -389,7 +386,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_resource_groups_operations_async.py index 300195501d90..1f14652f6268 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_resource_groups_operations_async.py @@ -78,7 +78,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -135,7 +134,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -148,7 +146,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -186,7 +183,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -204,7 +200,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -219,8 +215,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -294,7 +290,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -356,7 +351,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -382,8 +376,8 @@ async def _export_template_initial( resource_group_name: str, parameters: "models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + ) -> Optional["models.ResourceGroupExportResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" @@ -406,7 +400,6 @@ async def _export_template_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -434,7 +427,7 @@ async def begin_export_template( resource_group_name: str, parameters: "models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> AsyncLROPoller["models.ResourceGroupExportResult"]: """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -447,8 +440,8 @@ async def begin_export_template( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: ResourceGroupExportResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroupExportResult + :return: An instance of AsyncLROPoller that returns either ResourceGroupExportResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroupExportResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -515,6 +508,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -530,15 +527,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_resources_operations_async.py index 674f5cf41c24..96f20db3c2b6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_resources_operations_async.py @@ -87,6 +87,10 @@ def list_by_resource_group( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -105,15 +109,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -168,7 +168,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -191,7 +190,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -210,8 +209,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -278,7 +277,6 @@ async def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -301,7 +299,7 @@ async def begin_validate_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -322,8 +320,8 @@ async def begin_validate_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -403,6 +401,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -420,15 +422,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -508,7 +506,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -556,7 +553,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -579,7 +575,7 @@ async def begin_delete( resource_name: str, api_version: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -601,8 +597,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -655,8 +651,8 @@ async def _create_or_update_initial( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -682,7 +678,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -718,7 +713,7 @@ async def begin_create_or_update( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -742,8 +737,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -800,8 +795,8 @@ async def _update_initial( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -827,7 +822,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -860,7 +854,7 @@ async def begin_update( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -884,8 +878,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -986,7 +980,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1040,7 +1033,6 @@ async def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,7 +1071,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1098,7 +1089,7 @@ async def begin_delete_by_id( resource_id: str, api_version: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1113,8 +1104,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1159,8 +1150,8 @@ async def _create_or_update_by_id_initial( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -1181,7 +1172,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1213,7 +1203,7 @@ async def begin_create_or_update_by_id( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1230,8 +1220,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1280,8 +1270,8 @@ async def _update_by_id_initial( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -1302,7 +1292,6 @@ async def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1331,7 +1320,7 @@ async def begin_update_by_id( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1348,8 +1337,8 @@ async def begin_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1430,7 +1419,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_tags_operations_async.py index 2905e6af2a59..61b1c7722e64 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations_async/_tags_operations_async.py @@ -79,7 +79,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,7 +131,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +139,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -193,7 +190,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +198,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -251,7 +246,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,6 +276,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -293,15 +291,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployment_operations_operations.py index 9f74f4d76c2d..4a9618c3da13 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployment_operations_operations.py @@ -88,7 +88,6 @@ def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,6 +131,10 @@ def list_at_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -146,15 +149,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -220,7 +219,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -261,6 +259,10 @@ def list_at_tenant_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -274,15 +276,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -352,7 +350,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,6 +393,10 @@ def list_at_management_group_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -410,15 +411,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -485,7 +482,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,6 +522,10 @@ def list_at_subscription_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -540,15 +540,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -619,7 +615,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -663,6 +658,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -678,15 +677,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py index 6e33d661801e..bafab19088c1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py @@ -74,7 +74,6 @@ def _delete_at_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,7 +93,7 @@ def begin_delete_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -193,7 +192,6 @@ def check_existence_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,7 +237,6 @@ def _create_or_update_at_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -252,7 +249,6 @@ def _create_or_update_at_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -272,7 +268,7 @@ def begin_create_or_update_at_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -372,7 +368,6 @@ def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -432,7 +427,6 @@ def cancel_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -491,7 +485,6 @@ def validate_at_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -504,7 +497,6 @@ def validate_at_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -556,7 +548,6 @@ def export_template_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -601,6 +592,10 @@ def list_at_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -616,15 +611,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -676,7 +667,6 @@ def _delete_at_tenant_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -695,7 +685,7 @@ def begin_delete_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -787,7 +777,6 @@ def check_existence_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -831,7 +820,6 @@ def _create_or_update_at_tenant_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -844,7 +832,6 @@ def _create_or_update_at_tenant_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -863,7 +850,7 @@ def begin_create_or_update_at_tenant_scope( parameters, # type: "models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -956,7 +943,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1012,7 +998,6 @@ def cancel_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1067,7 +1052,6 @@ def validate_at_tenant_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1080,7 +1064,6 @@ def validate_at_tenant_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1128,7 +1111,6 @@ def export_template_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1170,6 +1152,10 @@ def list_at_tenant_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -1181,15 +1167,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1243,7 +1225,6 @@ def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1263,7 +1244,7 @@ def begin_delete_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1362,7 +1343,6 @@ def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1408,7 +1388,6 @@ def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1421,7 +1400,6 @@ def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1441,7 +1419,7 @@ def begin_create_or_update_at_management_group_scope( parameters, # type: "models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1541,7 +1519,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1601,7 +1578,6 @@ def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1660,7 +1636,6 @@ def validate_at_management_group_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1673,7 +1648,6 @@ def validate_at_management_group_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -1725,7 +1699,6 @@ def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1770,6 +1743,10 @@ def list_at_management_group_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -1785,15 +1762,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1846,7 +1819,6 @@ def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1865,7 +1837,7 @@ def begin_delete_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1958,7 +1930,6 @@ def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2003,7 +1974,6 @@ def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2016,7 +1986,6 @@ def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2035,7 +2004,7 @@ def begin_create_or_update_at_subscription_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2129,7 +2098,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2186,7 +2154,6 @@ def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2242,7 +2209,6 @@ def validate_at_subscription_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2255,7 +2221,6 @@ def validate_at_subscription_scope( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -2274,8 +2239,8 @@ def _what_if_at_subscription_scope_initial( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> "models.WhatIfOperationResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" @@ -2298,7 +2263,6 @@ def _what_if_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -2332,7 +2296,7 @@ def begin_what_if_at_subscription_scope( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2425,7 +2389,6 @@ def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2467,6 +2430,10 @@ def list_at_subscription_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -2482,15 +2449,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -2545,7 +2508,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2565,7 +2527,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -2668,7 +2630,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2715,7 +2676,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2728,7 +2688,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2748,7 +2707,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -2850,7 +2809,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2911,7 +2869,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2972,7 +2929,6 @@ def validate( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2985,7 +2941,6 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) @@ -3005,8 +2960,8 @@ def _what_if_initial( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> "models.WhatIfOperationResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" @@ -3030,7 +2985,6 @@ def _what_if_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -3065,7 +3019,7 @@ def begin_what_if( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3166,7 +3120,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3212,6 +3165,10 @@ def list_by_resource_group( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -3228,15 +3185,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -3296,7 +3249,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py index 8c75c89ac3e8..fe209bd1db23 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_providers_operations.py index a02d94c2e6e6..331edacfe2a2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,6 +175,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +194,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -253,6 +251,10 @@ def list_at_tenant_scope( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -264,15 +266,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -341,7 +339,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -399,7 +396,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resource_groups_operations.py index d3d084bc1353..55a8557750e2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resource_groups_operations.py @@ -83,7 +83,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +140,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -154,7 +152,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -193,7 +190,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,7 +208,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -303,7 +299,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -366,7 +361,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -393,8 +387,8 @@ def _export_template_initial( parameters, # type: "models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + # type: (...) -> Optional["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-08-01" @@ -417,7 +411,6 @@ def _export_template_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -446,7 +439,7 @@ def begin_export_template( parameters, # type: "models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.ResourceGroupExportResult"] """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -528,6 +521,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -543,15 +540,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py index 8b41886a9836..7459ea61df5e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py @@ -92,6 +92,10 @@ def list_by_resource_group( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -110,15 +114,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -174,7 +174,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -198,7 +197,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -286,7 +285,6 @@ def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -310,7 +308,7 @@ def begin_validate_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -413,6 +411,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -430,15 +432,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -519,7 +517,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -568,7 +565,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -592,7 +588,7 @@ def begin_delete( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -669,8 +665,8 @@ def _create_or_update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -696,7 +692,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -733,7 +728,7 @@ def begin_create_or_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -816,8 +811,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -843,7 +838,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -877,7 +871,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -1004,7 +998,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1059,7 +1052,6 @@ def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1099,7 +1091,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1119,7 +1110,7 @@ def begin_delete_by_id( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1181,8 +1172,8 @@ def _create_or_update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -1203,7 +1194,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1236,7 +1226,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1304,8 +1294,8 @@ def _update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -1326,7 +1316,6 @@ def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1356,7 +1345,7 @@ def begin_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1456,7 +1445,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_tags_operations.py index 8862bec733c3..c1432b860054 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_tags_operations.py @@ -84,7 +84,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,7 +137,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -200,7 +197,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +205,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -259,7 +254,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +285,10 @@ def list( api_version = "2019-08-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -302,15 +300,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_deployment_operations_operations_async.py index 671b9306259c..24318dcaf48d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_deployment_operations_operations_async.py @@ -83,7 +83,6 @@ async def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -126,6 +125,10 @@ def list_at_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -140,15 +143,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -213,7 +212,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,6 +251,10 @@ def list_at_tenant_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -266,15 +268,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -343,7 +341,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -386,6 +383,10 @@ def list_at_management_group_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -400,15 +401,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -474,7 +471,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,6 +510,10 @@ def list_at_subscription_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -528,15 +528,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -606,7 +602,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -649,6 +644,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -664,15 +663,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_deployments_operations_async.py index e3677404325d..834210e86794 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_deployments_operations_async.py @@ -69,7 +69,6 @@ async def _delete_at_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -88,7 +87,7 @@ async def begin_delete_at_scope( scope: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -109,8 +108,8 @@ async def begin_delete_at_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -186,7 +185,6 @@ async def check_existence_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,7 +229,6 @@ async def _create_or_update_at_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -244,7 +241,6 @@ async def _create_or_update_at_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -263,7 +259,7 @@ async def begin_create_or_update_at_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -280,8 +276,8 @@ async def begin_create_or_update_at_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -362,7 +358,6 @@ async def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -421,7 +416,6 @@ async def cancel_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -441,8 +435,8 @@ async def _validate_at_scope_initial( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -465,7 +459,6 @@ async def _validate_at_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -497,7 +490,7 @@ async def begin_validate_at_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -513,8 +506,8 @@ async def begin_validate_at_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -595,7 +588,6 @@ async def export_template_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -639,6 +631,10 @@ def list_at_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -654,15 +650,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -713,7 +705,6 @@ async def _delete_at_tenant_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -731,7 +722,7 @@ async def begin_delete_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -750,8 +741,8 @@ async def begin_delete_at_tenant_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -822,7 +813,6 @@ async def check_existence_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,7 +855,6 @@ async def _create_or_update_at_tenant_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -878,7 +867,6 @@ async def _create_or_update_at_tenant_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -896,7 +884,7 @@ async def begin_create_or_update_at_tenant_scope( deployment_name: str, parameters: "models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -911,8 +899,8 @@ async def begin_create_or_update_at_tenant_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -988,7 +976,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1043,7 +1030,6 @@ async def cancel_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1062,8 +1048,8 @@ async def _validate_at_tenant_scope_initial( deployment_name: str, parameters: "models.ScopedDeployment", **kwargs - ) -> "models.DeploymentValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -1085,7 +1071,6 @@ async def _validate_at_tenant_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1116,7 +1101,7 @@ async def begin_validate_at_tenant_scope( deployment_name: str, parameters: "models.ScopedDeployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1130,8 +1115,8 @@ async def begin_validate_at_tenant_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1173,6 +1158,123 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_validate_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + async def _what_if_at_tenant_scope_initial( + self, + deployment_name: str, + parameters: "models.ScopedDeploymentWhatIf", + **kwargs + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if_at_tenant_scope( + self, + deployment_name: str, + parameters: "models.ScopedDeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._what_if_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + async def export_template_at_tenant_scope( self, deployment_name: str, @@ -1207,7 +1309,6 @@ async def export_template_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1248,6 +1349,10 @@ def list_at_tenant_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -1259,15 +1364,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1320,7 +1421,6 @@ async def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1339,7 +1439,7 @@ async def begin_delete_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1360,8 +1460,8 @@ async def begin_delete_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1437,7 +1537,6 @@ async def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1482,7 +1581,6 @@ async def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1495,7 +1593,6 @@ async def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1514,7 +1611,7 @@ async def begin_create_or_update_at_management_group_scope( deployment_name: str, parameters: "models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1531,8 +1628,8 @@ async def begin_create_or_update_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1613,7 +1710,6 @@ async def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1672,7 +1768,6 @@ async def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1692,8 +1787,8 @@ async def _validate_at_management_group_scope_initial( deployment_name: str, parameters: "models.ScopedDeployment", **kwargs - ) -> "models.DeploymentValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -1716,7 +1811,6 @@ async def _validate_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1748,7 +1842,7 @@ async def begin_validate_at_management_group_scope( deployment_name: str, parameters: "models.ScopedDeployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1764,8 +1858,8 @@ async def begin_validate_at_management_group_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1808,6 +1902,129 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_validate_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + async def _what_if_at_management_group_scope_initial( + self, + group_id: str, + deployment_name: str, + parameters: "models.ScopedDeploymentWhatIf", + **kwargs + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: "models.ScopedDeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._what_if_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + async def export_template_at_management_group_scope( self, group_id: str, @@ -1846,7 +2063,6 @@ async def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1890,6 +2106,10 @@ def list_at_management_group_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -1905,15 +2125,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1965,7 +2181,6 @@ async def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1983,7 +2198,7 @@ async def begin_delete_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -2002,8 +2217,8 @@ async def begin_delete_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2075,7 +2290,6 @@ async def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2119,7 +2333,6 @@ async def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2132,7 +2345,6 @@ async def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2150,7 +2362,7 @@ async def begin_create_or_update_at_subscription_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2165,8 +2377,8 @@ async def begin_create_or_update_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2243,7 +2455,6 @@ async def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2299,7 +2510,6 @@ async def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2318,8 +2528,8 @@ async def _validate_at_subscription_scope_initial( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -2342,7 +2552,6 @@ async def _validate_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2373,7 +2582,7 @@ async def begin_validate_at_subscription_scope( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2387,8 +2596,8 @@ async def begin_validate_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2435,8 +2644,8 @@ async def _what_if_at_subscription_scope_initial( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -2459,7 +2668,6 @@ async def _what_if_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -2492,7 +2700,7 @@ async def begin_what_if_at_subscription_scope( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2506,8 +2714,8 @@ async def begin_what_if_at_subscription_scope( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: WhatIfOperationResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.WhatIfOperationResult + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.WhatIfOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2584,7 +2792,6 @@ async def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2625,6 +2832,10 @@ def list_at_subscription_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -2640,15 +2851,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -2702,7 +2909,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2721,7 +2927,7 @@ async def begin_delete( resource_group_name: str, deployment_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -2744,8 +2950,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2823,7 +3029,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2869,7 +3074,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2882,7 +3086,6 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2901,7 +3104,7 @@ async def begin_create_or_update( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentExtended": + ) -> AsyncLROPoller["models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -2919,8 +3122,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentExtended, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3002,7 +3205,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3062,7 +3264,6 @@ async def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3082,8 +3283,8 @@ async def _validate_initial( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -3107,7 +3308,6 @@ async def _validate_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -3139,7 +3339,7 @@ async def begin_validate( deployment_name: str, parameters: "models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -3156,8 +3356,8 @@ async def begin_validate( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: DeploymentValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentValidateResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3206,8 +3406,8 @@ async def _what_if_initial( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -3231,7 +3431,6 @@ async def _what_if_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -3265,7 +3464,7 @@ async def begin_what_if( deployment_name: str, parameters: "models.DeploymentWhatIf", **kwargs - ) -> "models.WhatIfOperationResult": + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3282,8 +3481,8 @@ async def begin_what_if( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: WhatIfOperationResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.WhatIfOperationResult + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.WhatIfOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3365,7 +3564,6 @@ async def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3410,6 +3608,10 @@ def list_by_resource_group( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -3426,15 +3628,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -3493,7 +3691,6 @@ async def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_operations_async.py index 7220279540c6..318e73071d9b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_providers_operations_async.py index ca11d030b39c..2eeef4b0f234 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_providers_operations_async.py @@ -76,7 +76,6 @@ async def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ async def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,6 +168,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +187,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -245,6 +243,10 @@ def list_at_tenant_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -256,15 +258,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -332,7 +330,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -389,7 +386,6 @@ async def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_resource_groups_operations_async.py index ef391ff871a0..a5f97f9931ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_resource_groups_operations_async.py @@ -78,7 +78,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -135,7 +134,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -148,7 +146,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -186,7 +183,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -204,7 +200,7 @@ async def begin_delete( self, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -219,8 +215,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -294,7 +290,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -356,7 +351,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -382,8 +376,8 @@ async def _export_template_initial( resource_group_name: str, parameters: "models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + ) -> Optional["models.ResourceGroupExportResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -406,7 +400,6 @@ async def _export_template_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -434,7 +427,7 @@ async def begin_export_template( resource_group_name: str, parameters: "models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> AsyncLROPoller["models.ResourceGroupExportResult"]: """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -447,8 +440,8 @@ async def begin_export_template( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: ResourceGroupExportResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroupExportResult + :return: An instance of AsyncLROPoller that returns either ResourceGroupExportResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroupExportResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -515,6 +508,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -530,15 +527,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_resources_operations_async.py index 9e9de2730ad8..53603f57ce08 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_resources_operations_async.py @@ -87,6 +87,10 @@ def list_by_resource_group( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -105,15 +109,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -168,7 +168,6 @@ async def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -191,7 +190,7 @@ async def begin_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -210,8 +209,8 @@ async def begin_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -278,7 +277,6 @@ async def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -301,7 +299,7 @@ async def begin_validate_move_resources( source_resource_group_name: str, parameters: "models.ResourcesMoveInfo", **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -322,8 +320,8 @@ async def begin_validate_move_resources( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -403,6 +401,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -420,15 +422,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -508,7 +506,6 @@ async def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -556,7 +553,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -579,7 +575,7 @@ async def begin_delete( resource_name: str, api_version: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -601,8 +597,8 @@ async def begin_delete( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -655,8 +651,8 @@ async def _create_or_update_initial( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -682,7 +678,6 @@ async def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -718,7 +713,7 @@ async def begin_create_or_update( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -742,8 +737,8 @@ async def begin_create_or_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -800,8 +795,8 @@ async def _update_initial( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -827,7 +822,6 @@ async def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -860,7 +854,7 @@ async def begin_update( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -884,8 +878,8 @@ async def begin_update( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -986,7 +980,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1040,7 +1033,6 @@ async def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,7 +1071,6 @@ async def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1098,7 +1089,7 @@ async def begin_delete_by_id( resource_id: str, api_version: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1113,8 +1104,8 @@ async def begin_delete_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1159,8 +1150,8 @@ async def _create_or_update_by_id_initial( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -1181,7 +1172,6 @@ async def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1213,7 +1203,7 @@ async def begin_create_or_update_by_id( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1230,8 +1220,8 @@ async def begin_create_or_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1280,8 +1270,8 @@ async def _update_by_id_initial( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -1302,7 +1292,6 @@ async def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1331,7 +1320,7 @@ async def begin_update_by_id( api_version: str, parameters: "models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> AsyncLROPoller["models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1348,8 +1337,8 @@ async def begin_update_by_id( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GenericResource, or the result of cls(response) - :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1430,7 +1419,6 @@ async def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_tags_operations_async.py index 4389d467f807..3d952a1ca52b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations_async/_tags_operations_async.py @@ -83,7 +83,6 @@ async def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -139,7 +138,6 @@ async def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -148,7 +146,6 @@ async def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -201,7 +198,6 @@ async def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -210,7 +206,6 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -261,7 +256,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -297,6 +291,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -308,15 +306,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -385,7 +379,6 @@ async def create_or_update_at_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'TagsResource') body_content_kwargs['content'] = body_content @@ -452,7 +445,6 @@ async def update_at_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'TagsPatchResource') body_content_kwargs['content'] = body_content @@ -509,7 +501,6 @@ async def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -561,7 +552,6 @@ async def delete_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/__init__.py index 2d1304dba393..53ceea1bfd74 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/__init__.py @@ -58,6 +58,7 @@ from ._models_py3 import ResourceReference from ._models_py3 import ResourcesMoveInfo from ._models_py3 import ScopedDeployment + from ._models_py3 import ScopedDeploymentWhatIf from ._models_py3 import Sku from ._models_py3 import SubResource from ._models_py3 import TagCount @@ -125,6 +126,7 @@ from ._models import ResourceReference # type: ignore from ._models import ResourcesMoveInfo # type: ignore from ._models import ScopedDeployment # type: ignore + from ._models import ScopedDeploymentWhatIf # type: ignore from ._models import Sku # type: ignore from ._models import SubResource # type: ignore from ._models import TagCount # type: ignore @@ -150,7 +152,7 @@ PropertyChangeType, ProvisioningOperation, ResourceIdentityType, - TagsPatchResourceOperation, + TagsPatchOperation, WhatIfResultFormat, ) @@ -206,6 +208,7 @@ 'ResourceReference', 'ResourcesMoveInfo', 'ScopedDeployment', + 'ScopedDeploymentWhatIf', 'Sku', 'SubResource', 'TagCount', @@ -229,6 +232,6 @@ 'PropertyChangeType', 'ProvisioningOperation', 'ResourceIdentityType', - 'TagsPatchResourceOperation', + 'TagsPatchOperation', 'WhatIfResultFormat', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py index 19a4d45bbd8e..4054e83576ce 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py @@ -1824,6 +1824,36 @@ def __init__( self.tags = kwargs.get('tags', None) +class ScopedDeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ScopedDeploymentWhatIf, self).__init__(**kwargs) + self.location = kwargs['location'] + self.properties = kwargs['properties'] + + class Sku(msrest.serialization.Model): """SKU for the resource. @@ -1996,8 +2026,7 @@ class TagsPatchResource(msrest.serialization.Model): :param operation: The operation type for the patch API. Possible values include: "Replace", "Merge", "Delete". - :type operation: str or - ~azure.mgmt.resource.resources.v2019_10_01.models.TagsPatchResourceOperation + :type operation: str or ~azure.mgmt.resource.resources.v2019_10_01.models.TagsPatchOperation :param properties: The set of tags. :type properties: ~azure.mgmt.resource.resources.v2019_10_01.models.Tags """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py index 35e8dc99cfed..20e355efa5e2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py @@ -1998,6 +1998,39 @@ def __init__( self.tags = tags +class ScopedDeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + *, + location: str, + properties: "DeploymentWhatIfProperties", + **kwargs + ): + super(ScopedDeploymentWhatIf, self).__init__(**kwargs) + self.location = location + self.properties = properties + + class Sku(msrest.serialization.Model): """SKU for the resource. @@ -2190,8 +2223,7 @@ class TagsPatchResource(msrest.serialization.Model): :param operation: The operation type for the patch API. Possible values include: "Replace", "Merge", "Delete". - :type operation: str or - ~azure.mgmt.resource.resources.v2019_10_01.models.TagsPatchResourceOperation + :type operation: str or ~azure.mgmt.resource.resources.v2019_10_01.models.TagsPatchOperation :param properties: The set of tags. :type properties: ~azure.mgmt.resource.resources.v2019_10_01.models.Tags """ @@ -2204,7 +2236,7 @@ class TagsPatchResource(msrest.serialization.Model): def __init__( self, *, - operation: Optional[Union[str, "TagsPatchResourceOperation"]] = None, + operation: Optional[Union[str, "TagsPatchOperation"]] = None, properties: Optional["Tags"] = None, **kwargs ): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py index 5b6d6606abbe..daaf8152f999 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py @@ -86,13 +86,13 @@ class ResourceIdentityType(str, Enum): system_assigned_user_assigned = "SystemAssigned, UserAssigned" none = "None" -class TagsPatchResourceOperation(str, Enum): +class TagsPatchOperation(str, Enum): """The operation type for the patch API. """ - replace = "Replace" - merge = "Merge" - delete = "Delete" + replace = "Replace" #: The 'replace' option replaces the entire set of existing tags with a new set. + merge = "Merge" #: The 'merge' option allows adding tags with new names and updating the values of tags with existing names. + delete = "Delete" #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. class WhatIfResultFormat(str, Enum): """The format of the What-If results diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployment_operations_operations.py index 20502085deee..00a9817ba12a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployment_operations_operations.py @@ -88,7 +88,6 @@ def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -132,6 +131,10 @@ def list_at_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -146,15 +149,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -220,7 +219,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -261,6 +259,10 @@ def list_at_tenant_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -274,15 +276,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -352,7 +350,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,6 +393,10 @@ def list_at_management_group_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -410,15 +411,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -485,7 +482,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,6 +522,10 @@ def list_at_subscription_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -540,15 +540,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -619,7 +615,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -663,6 +658,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -678,15 +677,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployments_operations.py index f897e6d6dfaa..d0e59dd9dc93 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployments_operations.py @@ -74,7 +74,6 @@ def _delete_at_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,7 +93,7 @@ def begin_delete_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -193,7 +192,6 @@ def check_existence_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,7 +237,6 @@ def _create_or_update_at_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -252,7 +249,6 @@ def _create_or_update_at_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -272,7 +268,7 @@ def begin_create_or_update_at_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -372,7 +368,6 @@ def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -432,7 +427,6 @@ def cancel_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -453,8 +447,8 @@ def _validate_at_scope_initial( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -477,7 +471,6 @@ def _validate_at_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -510,7 +503,7 @@ def begin_validate_at_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -609,7 +602,6 @@ def export_template_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -654,6 +646,10 @@ def list_at_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_scope.metadata['url'] # type: ignore @@ -669,15 +665,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -729,7 +721,6 @@ def _delete_at_tenant_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -748,7 +739,7 @@ def begin_delete_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -840,7 +831,6 @@ def check_existence_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -884,7 +874,6 @@ def _create_or_update_at_tenant_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -897,7 +886,6 @@ def _create_or_update_at_tenant_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -916,7 +904,7 @@ def begin_create_or_update_at_tenant_scope( parameters, # type: "models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1009,7 +997,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1065,7 +1052,6 @@ def cancel_at_tenant_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1085,8 +1071,8 @@ def _validate_at_tenant_scope_initial( parameters, # type: "models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -1108,7 +1094,6 @@ def _validate_at_tenant_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1140,7 +1125,7 @@ def begin_validate_at_tenant_scope( parameters, # type: "models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1197,6 +1182,125 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_validate_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + def _what_if_at_tenant_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if_at_tenant_scope( + self, + deployment_name, # type: str + parameters, # type: "models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._what_if_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + def export_template_at_tenant_scope( self, deployment_name, # type: str @@ -1232,7 +1336,6 @@ def export_template_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1274,6 +1377,10 @@ def list_at_tenant_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -1285,15 +1392,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1347,7 +1450,6 @@ def _delete_at_management_group_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1367,7 +1469,7 @@ def begin_delete_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -1466,7 +1568,6 @@ def check_existence_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1512,7 +1613,6 @@ def _create_or_update_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1525,7 +1625,6 @@ def _create_or_update_at_management_group_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -1545,7 +1644,7 @@ def begin_create_or_update_at_management_group_scope( parameters, # type: "models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1645,7 +1744,6 @@ def get_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1705,7 +1803,6 @@ def cancel_at_management_group_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1726,8 +1823,8 @@ def _validate_at_management_group_scope_initial( parameters, # type: "models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -1750,7 +1847,6 @@ def _validate_at_management_group_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ScopedDeployment') body_content_kwargs['content'] = body_content @@ -1783,7 +1879,7 @@ def begin_validate_at_management_group_scope( parameters, # type: "models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1843,6 +1939,131 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_validate_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + def _what_if_at_management_group_scope_initial( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2019_10_01.models.ScopedDeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2019_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._what_if_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + def export_template_at_management_group_scope( self, group_id, # type: str @@ -1882,7 +2103,6 @@ def export_template_at_management_group_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1927,6 +2147,10 @@ def list_at_management_group_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_management_group_scope.metadata['url'] # type: ignore @@ -1942,15 +2166,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -2003,7 +2223,6 @@ def _delete_at_subscription_scope_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2022,7 +2241,7 @@ def begin_delete_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -2115,7 +2334,6 @@ def check_existence_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2160,7 +2378,6 @@ def _create_or_update_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2173,7 +2390,6 @@ def _create_or_update_at_subscription_scope_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2192,7 +2408,7 @@ def begin_create_or_update_at_subscription_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2286,7 +2502,6 @@ def get_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2343,7 +2558,6 @@ def cancel_at_subscription_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2363,8 +2577,8 @@ def _validate_at_subscription_scope_initial( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -2387,7 +2601,6 @@ def _validate_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2419,7 +2632,7 @@ def begin_validate_at_subscription_scope( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2482,8 +2695,8 @@ def _what_if_at_subscription_scope_initial( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> "models.WhatIfOperationResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -2506,7 +2719,6 @@ def _what_if_at_subscription_scope_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -2540,7 +2752,7 @@ def begin_what_if_at_subscription_scope( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2633,7 +2845,6 @@ def export_template_at_subscription_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2675,6 +2886,10 @@ def list_at_subscription_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_subscription_scope.metadata['url'] # type: ignore @@ -2690,15 +2905,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -2753,7 +2964,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2773,7 +2983,7 @@ def begin_delete( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a deployment from the deployment history. A template deployment that is currently running cannot be deleted. Deleting a template @@ -2876,7 +3086,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2923,7 +3132,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -2936,7 +3144,6 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentExtended', pipeline_response) @@ -2956,7 +3163,7 @@ def begin_create_or_update( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -3058,7 +3265,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3119,7 +3325,6 @@ def cancel( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3140,8 +3345,8 @@ def _validate_initial( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -3165,7 +3370,6 @@ def _validate_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'Deployment') body_content_kwargs['content'] = body_content @@ -3198,7 +3402,7 @@ def begin_validate( parameters, # type: "models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -3266,8 +3470,8 @@ def _what_if_initial( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> "models.WhatIfOperationResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -3291,7 +3495,6 @@ def _what_if_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'DeploymentWhatIf') body_content_kwargs['content'] = body_content @@ -3326,7 +3529,7 @@ def begin_what_if( parameters, # type: "models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3427,7 +3630,6 @@ def export_template( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3473,6 +3675,10 @@ def list_by_resource_group( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -3489,15 +3695,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -3557,7 +3759,6 @@ def calculate_template_hash( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(template, 'object') body_content_kwargs['content'] = body_content diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py index b452ae9920c6..3c00410534b0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_providers_operations.py index ecc316da3a0d..7cc594387cd2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_providers_operations.py @@ -81,7 +81,6 @@ def unregister( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -134,7 +133,6 @@ def register( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,6 +175,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +194,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -253,6 +251,10 @@ def list_at_tenant_scope( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_at_tenant_scope.metadata['url'] # type: ignore @@ -264,15 +266,11 @@ def prepare_request(next_link=None): query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -341,7 +339,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -399,7 +396,6 @@ def get_at_tenant_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resource_groups_operations.py index ae7ab6140b94..0e1ebde8d745 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resource_groups_operations.py @@ -83,7 +83,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -141,7 +140,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroup') body_content_kwargs['content'] = body_content @@ -154,7 +152,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('ResourceGroup', pipeline_response) @@ -193,7 +190,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,7 +208,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource group. When you delete a resource group, all of its resources are also deleted. Deleting a resource @@ -303,7 +299,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -366,7 +361,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') body_content_kwargs['content'] = body_content @@ -393,8 +387,8 @@ def _export_template_initial( parameters, # type: "models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + # type: (...) -> Optional["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-10-01" @@ -417,7 +411,6 @@ def _export_template_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ExportTemplateRequest') body_content_kwargs['content'] = body_content @@ -446,7 +439,7 @@ def begin_export_template( parameters, # type: "models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.ResourceGroupExportResult"] """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -528,6 +521,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -543,15 +540,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resources_operations.py index a3711a60de4c..61adfa20d17a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resources_operations.py @@ -92,6 +92,10 @@ def list_by_resource_group( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -110,15 +114,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -174,7 +174,6 @@ def _move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -198,7 +197,7 @@ def begin_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may @@ -286,7 +285,6 @@ def _validate_move_resources_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') body_content_kwargs['content'] = body_content @@ -310,7 +308,7 @@ def begin_validate_move_resources( parameters, # type: "models.ResourcesMoveInfo" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources @@ -413,6 +411,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -430,15 +432,11 @@ def prepare_request(next_link=None): query_parameters['$top'] = self._serialize.query("top", top, 'int') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -519,7 +517,6 @@ def check_existence( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -568,7 +565,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -592,7 +588,7 @@ def begin_delete( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource. :param resource_group_name: The name of the resource group that contains the resource to @@ -669,8 +665,8 @@ def _create_or_update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -696,7 +692,6 @@ def _create_or_update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -733,7 +728,7 @@ def begin_create_or_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -816,8 +811,8 @@ def _update_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -843,7 +838,6 @@ def _update_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -877,7 +871,7 @@ def begin_update( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -1004,7 +998,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1059,7 +1052,6 @@ def check_existence_by_id( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1099,7 +1091,6 @@ def _delete_by_id_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1119,7 +1110,7 @@ def begin_delete_by_id( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1181,8 +1172,8 @@ def _create_or_update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -1203,7 +1194,6 @@ def _create_or_update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1236,7 +1226,7 @@ def begin_create_or_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1304,8 +1294,8 @@ def _update_by_id_initial( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") @@ -1326,7 +1316,6 @@ def _update_by_id_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'GenericResource') body_content_kwargs['content'] = body_content @@ -1356,7 +1345,7 @@ def begin_update_by_id( parameters, # type: "models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1456,7 +1445,6 @@ def get_by_id( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py index d2ddfe3843d8..6ca01c723fe8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py @@ -88,7 +88,6 @@ def delete_value( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -145,7 +144,6 @@ def create_or_update_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -154,7 +152,6 @@ def create_or_update_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagValue', pipeline_response) @@ -208,7 +205,6 @@ def create_or_update( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -217,7 +213,6 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TagDetails', pipeline_response) @@ -269,7 +264,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,6 +300,10 @@ def list( api_version = "2019-10-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -317,15 +315,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -395,7 +389,6 @@ def create_or_update_at_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'TagsResource') body_content_kwargs['content'] = body_content @@ -463,7 +456,6 @@ def update_at_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'TagsPatchResource') body_content_kwargs['content'] = body_content @@ -521,7 +513,6 @@ def get_at_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -574,7 +565,6 @@ def delete_at_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/__init__.py new file mode 100644 index 000000000000..fde2ed4c3b83 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._resource_management_client import ResourceManagementClient +__all__ = ['ResourceManagementClient'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_configuration.py new file mode 100644 index 000000000000..99a518144653 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_configuration.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ResourceManagementClientConfiguration(Configuration): + """Configuration for ResourceManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ResourceManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-06-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json new file mode 100644 index 000000000000..0c60f7565b94 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json @@ -0,0 +1,59 @@ +{ + "chosen_version": "2020-06-01", + "total_api_version_list": ["2020-06-01"], + "client": { + "name": "ResourceManagementClient", + "filename": "_resource_management_client", + "description": "Provides operations for working with resources and resource groups." + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] + }, + "operation_groups": { + "operations": "Operations", + "deployments": "DeploymentsOperations", + "providers": "ProvidersOperations", + "resources": "ResourcesOperations", + "resource_groups": "ResourceGroupsOperations", + "tags": "TagsOperations", + "deployment_operations": "DeploymentOperationsOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py new file mode 100644 index 000000000000..f01b2936e92f --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import ResourceManagementClientConfiguration +from .operations import Operations +from .operations import DeploymentsOperations +from .operations import ProvidersOperations +from .operations import ResourcesOperations +from .operations import ResourceGroupsOperations +from .operations import TagsOperations +from .operations import DeploymentOperationsOperations +from . import models + + +class ResourceManagementClient(object): + """Provides operations for working with resources and resource groups. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resource.resources.v2020_06_01.operations.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.resource.resources.v2020_06_01.operations.DeploymentsOperations + :ivar providers: ProvidersOperations operations + :vartype providers: azure.mgmt.resource.resources.v2020_06_01.operations.ProvidersOperations + :ivar resources: ResourcesOperations operations + :vartype resources: azure.mgmt.resource.resources.v2020_06_01.operations.ResourcesOperations + :ivar resource_groups: ResourceGroupsOperations operations + :vartype resource_groups: azure.mgmt.resource.resources.v2020_06_01.operations.ResourceGroupsOperations + :ivar tags: TagsOperations operations + :vartype tags: azure.mgmt.resource.resources.v2020_06_01.operations.TagsOperations + :ivar deployment_operations: DeploymentOperationsOperations operations + :vartype deployment_operations: azure.mgmt.resource.resources.v2020_06_01.operations.DeploymentOperationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ResourceManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.providers = ProvidersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resources = ResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_groups = ResourceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tags = TagsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployment_operations = DeploymentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ResourceManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/__init__.py new file mode 100644 index 000000000000..7f9b1bac71c5 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._resource_management_client_async import ResourceManagementClient +__all__ = ['ResourceManagementClient'] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_configuration_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_configuration_async.py new file mode 100644 index 000000000000..ee56212e5df5 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_configuration_async.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ResourceManagementClientConfiguration(Configuration): + """Configuration for ResourceManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ResourceManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-06-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client_async.py new file mode 100644 index 000000000000..4fea200dfe79 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client_async.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration_async import ResourceManagementClientConfiguration +from .operations_async import Operations +from .operations_async import DeploymentsOperations +from .operations_async import ProvidersOperations +from .operations_async import ResourcesOperations +from .operations_async import ResourceGroupsOperations +from .operations_async import TagsOperations +from .operations_async import DeploymentOperationsOperations +from .. import models + + +class ResourceManagementClient(object): + """Provides operations for working with resources and resource groups. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resource.resources.v2020_06_01.aio.operations_async.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.resource.resources.v2020_06_01.aio.operations_async.DeploymentsOperations + :ivar providers: ProvidersOperations operations + :vartype providers: azure.mgmt.resource.resources.v2020_06_01.aio.operations_async.ProvidersOperations + :ivar resources: ResourcesOperations operations + :vartype resources: azure.mgmt.resource.resources.v2020_06_01.aio.operations_async.ResourcesOperations + :ivar resource_groups: ResourceGroupsOperations operations + :vartype resource_groups: azure.mgmt.resource.resources.v2020_06_01.aio.operations_async.ResourceGroupsOperations + :ivar tags: TagsOperations operations + :vartype tags: azure.mgmt.resource.resources.v2020_06_01.aio.operations_async.TagsOperations + :ivar deployment_operations: DeploymentOperationsOperations operations + :vartype deployment_operations: azure.mgmt.resource.resources.v2020_06_01.aio.operations_async.DeploymentOperationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ResourceManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.providers = ProvidersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resources = ResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_groups = ResourceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tags = TagsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployment_operations = DeploymentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ResourceManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..f1fd8637fa69 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations_async import Operations +from ._deployments_operations_async import DeploymentsOperations +from ._providers_operations_async import ProvidersOperations +from ._resources_operations_async import ResourcesOperations +from ._resource_groups_operations_async import ResourceGroupsOperations +from ._tags_operations_async import TagsOperations +from ._deployment_operations_operations_async import DeploymentOperationsOperations + +__all__ = [ + 'Operations', + 'DeploymentsOperations', + 'ProvidersOperations', + 'ResourcesOperations', + 'ResourceGroupsOperations', + 'TagsOperations', + 'DeploymentOperationsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_deployment_operations_operations_async.py new file mode 100644 index 000000000000..b458ab96e400 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_deployment_operations_operations_async.py @@ -0,0 +1,695 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentOperationsOperations: + """DeploymentOperationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_at_scope( + self, + scope: str, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "models.DeploymentOperation": + """Gets a deployments operation. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_scope( + self, + scope: str, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + async def get_at_tenant_scope( + self, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "models.DeploymentOperation": + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_tenant_scope( + self, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + async def get_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "models.DeploymentOperation": + """Gets a deployments operation. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + async def get_at_subscription_scope( + self, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "models.DeploymentOperation": + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_subscription_scope( + self, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + async def get( + self, + resource_group_name: str, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "models.DeploymentOperation": + """Gets a deployments operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list( + self, + resource_group_name: str, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_deployments_operations_async.py new file mode 100644 index 000000000000..003cb9545272 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_deployments_operations_async.py @@ -0,0 +1,3712 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations: + """DeploymentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_at_scope_initial( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> None: + """Checks whether the deployment exists. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_at_scope_initial( + self, + scope: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> "models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update_at_scope( + self, + scope: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentExtended"]: + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExtended": + """Gets a deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_at_scope_initial( + self, + scope: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate_at_scope( + self, + scope: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def export_template_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_scope( + self, + scope: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentListResult"]: + """Get all the deployments at the given scope. + + :param scope: The resource scope. + :type scope: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def _delete_at_tenant_scope_initial( + self, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_at_tenant_scope_initial( + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> None: + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_at_tenant_scope_initial( + self, + deployment_name: str, + parameters: "models.ScopedDeployment", + **kwargs + ) -> "models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update_at_tenant_scope( + self, + deployment_name: str, + parameters: "models.ScopedDeployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentExtended"]: + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExtended": + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_at_tenant_scope_initial( + self, + deployment_name: str, + parameters: "models.ScopedDeployment", + **kwargs + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate_at_tenant_scope( + self, + deployment_name: str, + parameters: "models.ScopedDeployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def _what_if_at_tenant_scope_initial( + self, + deployment_name: str, + parameters: "models.ScopedDeploymentWhatIf", + **kwargs + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if_at_tenant_scope( + self, + deployment_name: str, + parameters: "models.ScopedDeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._what_if_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def export_template_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_tenant_scope( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentListResult"]: + """Get all the deployments at the tenant scope. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def _delete_at_management_group_scope_initial( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> None: + """Checks whether the deployment exists. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_at_management_group_scope_initial( + self, + group_id: str, + deployment_name: str, + parameters: "models.ScopedDeployment", + **kwargs + ) -> "models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: "models.ScopedDeployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentExtended"]: + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExtended": + """Gets a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_at_management_group_scope_initial( + self, + group_id: str, + deployment_name: str, + parameters: "models.ScopedDeployment", + **kwargs + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: "models.ScopedDeployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def _what_if_at_management_group_scope_initial( + self, + group_id: str, + deployment_name: str, + parameters: "models.ScopedDeploymentWhatIf", + **kwargs + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: "models.ScopedDeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._what_if_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def export_template_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_management_group_scope( + self, + group_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentListResult"]: + """Get all the deployments for a management group. + + :param group_id: The management group ID. + :type group_id: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def _delete_at_subscription_scope_initial( + self, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_at_subscription_scope_initial( + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> None: + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_at_subscription_scope_initial( + self, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> "models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update_at_subscription_scope( + self, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentExtended"]: + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExtended": + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_at_subscription_scope_initial( + self, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate_at_subscription_scope( + self, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def _what_if_at_subscription_scope_initial( + self, + deployment_name: str, + parameters: "models.DeploymentWhatIf", + **kwargs + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if_at_subscription_scope( + self, + deployment_name: str, + parameters: "models.DeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to What If. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._what_if_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def export_template_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_subscription_scope( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentListResult"]: + """Get all the deployments for a subscription. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. Deleting a template deployment does + not affect the state of the resource group. This is an asynchronous operation that returns a + status of 202 until the template deployment is successfully deleted. The Location response + header contains the URI that is used to obtain the status of the process. While the process is + running, a call to the URI in the Location header returns a status of 202. When the process + finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param resource_group_name: The name of the resource group with the deployment to delete. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> None: + """Checks whether the deployment exists. + + :param resource_group_name: The name of the resource group with the deployment to check. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> "models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentExtended"]: + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExtended": + """Gets a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resource group + partially deployed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> Optional["models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate( + self, + resource_group_name: str, + deployment_name: str, + parameters: "models.Deployment", + **kwargs + ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def _what_if_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: "models.DeploymentWhatIf", + **kwargs + ) -> Optional["models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if( + self, + resource_group_name: str, + deployment_name: str, + parameters: "models.DeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._what_if_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def export_template( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> "models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeploymentListResult"]: + """Get all the deployments for a resource group. + + :param resource_group_name: The name of the resource group with the deployments to get. The + name is case insensitive. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def calculate_template_hash( + self, + template: object, + **kwargs + ) -> "models.TemplateHashResult": + """Calculate the hash of the given template. + + :param template: The template provided to calculate hash. + :type template: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateHashResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateHashResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.calculate_template_hash.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(template, 'object') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TemplateHashResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + calculate_template_hash.metadata = {'url': '/providers/Microsoft.Resources/calculateTemplateHash'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_operations_async.py new file mode 100644 index 000000000000..d22d478ebe66 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_operations_async.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationListResult"]: + """Lists all of the available Microsoft.Resources REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Resources/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_providers_operations_async.py new file mode 100644 index 000000000000..643bf8ba34dd --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_providers_operations_async.py @@ -0,0 +1,403 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProvidersOperations: + """ProvidersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def unregister( + self, + resource_provider_namespace: str, + **kwargs + ) -> "models.Provider": + """Unregisters a subscription from a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to unregister. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.unregister.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + unregister.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister'} # type: ignore + + async def register( + self, + resource_provider_namespace: str, + **kwargs + ) -> "models.Provider": + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.register.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + register.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register'} # type: ignore + + def list( + self, + top: Optional[int] = None, + expand: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ProviderListResult"]: + """Gets all resource providers for a subscription. + + :param top: The number of results to return. If null is passed returns all deployments. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers'} # type: ignore + + def list_at_tenant_scope( + self, + top: Optional[int] = None, + expand: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ProviderListResult"]: + """Gets all resource providers for the tenant. + + :param top: The number of results to return. If null is passed returns all providers. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers'} # type: ignore + + async def get( + self, + resource_provider_namespace: str, + expand: Optional[str] = None, + **kwargs + ) -> "models.Provider": + """Gets the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}'} # type: ignore + + async def get_at_tenant_scope( + self, + resource_provider_namespace: str, + expand: Optional[str] = None, + **kwargs + ) -> "models.Provider": + """Gets the specified resource provider at the tenant level. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/{resourceProviderNamespace}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_resource_groups_operations_async.py new file mode 100644 index 000000000000..ff16d7c0e014 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_resource_groups_operations_async.py @@ -0,0 +1,559 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceGroupsOperations: + """ResourceGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_existence( + self, + resource_group_name: str, + **kwargs + ) -> None: + """Checks whether a resource group exists. + + :param resource_group_name: The name of the resource group to check. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + parameters: "models.ResourceGroup", + **kwargs + ) -> "models.ResourceGroup": + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a resource group. + + When you delete a resource group, all of its resources are also deleted. Deleting a resource + group deletes all of its template deployments and currently stored operations. + + :param resource_group_name: The name of the resource group to delete. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + **kwargs + ) -> "models.ResourceGroup": + """Gets a resource group. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + parameters: "models.ResourceGroupPatchable", + **kwargs + ) -> "models.ResourceGroup": + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def _export_template_initial( + self, + resource_group_name: str, + parameters: "models.ExportTemplateRequest", + **kwargs + ) -> Optional["models.ResourceGroupExportResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._export_template_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ExportTemplateRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _export_template_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + async def begin_export_template( + self, + resource_group_name: str, + parameters: "models.ExportTemplateRequest", + **kwargs + ) -> AsyncLROPoller["models.ResourceGroupExportResult"]: + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ExportTemplateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ResourceGroupExportResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._export_template_initial( + resource_group_name=resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.ResourceGroupListResult"]: + """Gets all the resource groups for a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by + tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq + 'tag1' and tagValue eq 'Value1'. + :type filter: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_resources_operations_async.py new file mode 100644 index 000000000000..d3eb190de749 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_resources_operations_async.py @@ -0,0 +1,1436 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourcesOperations: + """ResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.ResourceListResult"]: + """Get all the resources for a resource group. + + :param resource_group_name: The resource group with the resources to get. + :type resource_group_name: str + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + the tags for each resource are not returned in the results.:code:`
`:code:`
`You can use + some properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resources. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources'} # type: ignore + + async def _move_resources_initial( + self, + source_resource_group_name: str, + parameters: "models.ResourcesMoveInfo", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + async def begin_move_resources( + self, + source_resource_group_name: str, + parameters: "models.ResourcesMoveInfo", + **kwargs + ) -> AsyncLROPoller[None]: + """Moves resources from one resource group to another resource group. + + The resources to move must be in the same source resource group. The target resource group may + be in a different subscription. When moving resources, both the source group and the target + group are locked for the duration of the operation. Write and delete operations are blocked on + the groups until the move completes. + + :param source_resource_group_name: The name of the resource group containing the resources to + move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourcesMoveInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + async def _validate_move_resources_initial( + self, + source_resource_group_name: str, + parameters: "models.ResourcesMoveInfo", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _validate_move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + async def begin_validate_move_resources( + self, + source_resource_group_name: str, + parameters: "models.ResourcesMoveInfo", + **kwargs + ) -> AsyncLROPoller[None]: + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to move must be in the same source resource group. The target resource group may be in a + different subscription. If validation succeeds, it returns HTTP response code 204 (no content). + If validation fails, it returns HTTP response code 409 (Conflict) with an error message. + Retrieve the URL in the Location header value to check the result of the long-running + operation. + + :param source_resource_group_name: The name of the resource group containing the resources to + validate for move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourcesMoveInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.ResourceListResult"]: + """Get all the resources in a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + the tags for each resource are not returned in the results.:code:`
`:code:`
`You can use + some properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + + async def check_existence( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs + ) -> None: + """Checks whether a resource exists. + + :param resource_group_name: The name of the resource group containing the resource to check. + The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The resource provider of the resource to check. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to check whether it exists. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a resource. + + :param resource_group_name: The name of the resource group that contains the resource to + delete. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to delete. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: "models.GenericResource", + **kwargs + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: "models.GenericResource", + **kwargs + ) -> AsyncLROPoller["models.GenericResource"]: + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. + :type resource_type: str + :param resource_name: The name of the resource to create. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: "models.GenericResource", + **kwargs + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: "models.GenericResource", + **kwargs + ) -> AsyncLROPoller["models.GenericResource"]: + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. + :type resource_type: str + :param resource_name: The name of the resource to update. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs + ) -> "models.GenericResource": + """Gets a resource. + + :param resource_group_name: The name of the resource group containing the resource to get. The + name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def check_existence_by_id( + self, + resource_id: str, + api_version: str, + **kwargs + ) -> None: + """Checks by ID whether a resource exists. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.check_existence_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def _delete_by_id_initial( + self, + resource_id: str, + api_version: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self._delete_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + async def begin_delete_by_id( + self, + resource_id: str, + api_version: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_by_id_initial( + resource_id=resource_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def _create_or_update_by_id_initial( + self, + resource_id: str, + api_version: str, + parameters: "models.GenericResource", + **kwargs + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + async def begin_create_or_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: "models.GenericResource", + **kwargs + ) -> AsyncLROPoller["models.GenericResource"]: + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Create or update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def _update_by_id_initial( + self, + resource_id: str, + api_version: str, + parameters: "models.GenericResource", + **kwargs + ) -> Optional["models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + async def begin_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: "models.GenericResource", + **kwargs + ) -> AsyncLROPoller["models.GenericResource"]: + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def get_by_id( + self, + resource_id: str, + api_version: str, + **kwargs + ) -> "models.GenericResource": + """Gets a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_id.metadata = {'url': '/{resourceId}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_tags_operations_async.py new file mode 100644 index 000000000000..0e49dda5a6a5 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations_async/_tags_operations_async.py @@ -0,0 +1,566 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TagsOperations: + """TagsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def delete_value( + self, + tag_name: str, + tag_value: str, + **kwargs + ) -> None: + """Deletes a predefined tag value for a predefined tag name. + + This operation allows deleting a value from the list of predefined values for an existing + predefined tag name. The value being deleted must not be in use as a tag value for the given + tag name for any resource. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to delete. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.delete_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + async def create_or_update_value( + self, + tag_name: str, + tag_value: str, + **kwargs + ) -> "models.TagValue": + """Creates a predefined value for a predefined tag name. + + This operation allows adding a value to the list of predefined values for an existing + predefined tag name. A tag value can have a maximum of 256 characters. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to create. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagValue, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.create_or_update_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagValue', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + async def create_or_update( + self, + tag_name: str, + **kwargs + ) -> "models.TagDetails": + """Creates a predefined tag name. + + This operation allows adding a name to the list of predefined tag names for the given + subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag + names cannot have the following prefixes which are reserved for Azure use: 'microsoft', + 'azure', 'windows'. + + :param tag_name: The name of the tag to create. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagDetails, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + async def delete( + self, + tag_name: str, + **kwargs + ) -> None: + """Deletes a predefined tag name. + + This operation allows deleting a name from the list of predefined tag names for the given + subscription. The name being deleted must not be in use as a tag name for any resource. All + predefined values for the given name must have already been deleted. + + :param tag_name: The name of the tag. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["models.TagsListResult"]: + """Gets a summary of tag usage under the subscription. + + This operation performs a union of predefined tags, resource tags, resource group tags and + subscription tags, and returns a summary of usage for each tag name and value under the given + subscription. In case of a large number of tags, this operation may return a previously cached + result. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TagsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.TagsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TagsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames'} # type: ignore + + async def create_or_update_at_scope( + self, + scope: str, + parameters: "models.TagsResource", + **kwargs + ) -> "models.TagsResource": + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. + :type scope: str + :param parameters: + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + async def update_at_scope( + self, + scope: str, + parameters: "models.TagsPatchResource", + **kwargs + ) -> "models.TagsResource": + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. + :type scope: str + :param parameters: + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + async def get_at_scope( + self, + scope: str, + **kwargs + ) -> "models.TagsResource": + """Gets the entire set of tags on a resource or subscription. + + Gets the entire set of tags on a resource or subscription. + + :param scope: The resource scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + async def delete_at_scope( + self, + scope: str, + **kwargs + ) -> None: + """Deletes the entire set of tags on a resource or subscription. + + Deletes the entire set of tags on a resource or subscription. + + :param scope: The resource scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.delete_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py new file mode 100644 index 000000000000..e3e01f11bb7b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py @@ -0,0 +1,252 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Alias + from ._models_py3 import AliasPath + from ._models_py3 import AliasPathMetadata + from ._models_py3 import AliasPattern + from ._models_py3 import ApiProfile + from ._models_py3 import BasicDependency + from ._models_py3 import DebugSetting + from ._models_py3 import Dependency + from ._models_py3 import Deployment + from ._models_py3 import DeploymentExportResult + from ._models_py3 import DeploymentExtended + from ._models_py3 import DeploymentExtendedFilter + from ._models_py3 import DeploymentListResult + from ._models_py3 import DeploymentOperation + from ._models_py3 import DeploymentOperationProperties + from ._models_py3 import DeploymentOperationsListResult + from ._models_py3 import DeploymentProperties + from ._models_py3 import DeploymentPropertiesExtended + from ._models_py3 import DeploymentValidateResult + from ._models_py3 import DeploymentWhatIf + from ._models_py3 import DeploymentWhatIfProperties + from ._models_py3 import DeploymentWhatIfSettings + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ExportTemplateRequest + from ._models_py3 import GenericResource + from ._models_py3 import GenericResourceExpanded + from ._models_py3 import GenericResourceFilter + from ._models_py3 import HttpMessage + from ._models_py3 import Identity + from ._models_py3 import IdentityUserAssignedIdentitiesValue + from ._models_py3 import OnErrorDeployment + from ._models_py3 import OnErrorDeploymentExtended + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import ParametersLink + from ._models_py3 import Plan + from ._models_py3 import Provider + from ._models_py3 import ProviderListResult + from ._models_py3 import ProviderResourceType + from ._models_py3 import Resource + from ._models_py3 import ResourceGroup + from ._models_py3 import ResourceGroupExportResult + from ._models_py3 import ResourceGroupFilter + from ._models_py3 import ResourceGroupListResult + from ._models_py3 import ResourceGroupPatchable + from ._models_py3 import ResourceGroupProperties + from ._models_py3 import ResourceListResult + from ._models_py3 import ResourceProviderOperationDisplayProperties + from ._models_py3 import ResourceReference + from ._models_py3 import ResourcesMoveInfo + from ._models_py3 import ScopedDeployment + from ._models_py3 import ScopedDeploymentWhatIf + from ._models_py3 import Sku + from ._models_py3 import StatusMessage + from ._models_py3 import SubResource + from ._models_py3 import TagCount + from ._models_py3 import TagDetails + from ._models_py3 import TagValue + from ._models_py3 import Tags + from ._models_py3 import TagsListResult + from ._models_py3 import TagsPatchResource + from ._models_py3 import TagsResource + from ._models_py3 import TargetResource + from ._models_py3 import TemplateHashResult + from ._models_py3 import TemplateLink + from ._models_py3 import WhatIfChange + from ._models_py3 import WhatIfOperationResult + from ._models_py3 import WhatIfPropertyChange +except (SyntaxError, ImportError): + from ._models import Alias # type: ignore + from ._models import AliasPath # type: ignore + from ._models import AliasPathMetadata # type: ignore + from ._models import AliasPattern # type: ignore + from ._models import ApiProfile # type: ignore + from ._models import BasicDependency # type: ignore + from ._models import DebugSetting # type: ignore + from ._models import Dependency # type: ignore + from ._models import Deployment # type: ignore + from ._models import DeploymentExportResult # type: ignore + from ._models import DeploymentExtended # type: ignore + from ._models import DeploymentExtendedFilter # type: ignore + from ._models import DeploymentListResult # type: ignore + from ._models import DeploymentOperation # type: ignore + from ._models import DeploymentOperationProperties # type: ignore + from ._models import DeploymentOperationsListResult # type: ignore + from ._models import DeploymentProperties # type: ignore + from ._models import DeploymentPropertiesExtended # type: ignore + from ._models import DeploymentValidateResult # type: ignore + from ._models import DeploymentWhatIf # type: ignore + from ._models import DeploymentWhatIfProperties # type: ignore + from ._models import DeploymentWhatIfSettings # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ExportTemplateRequest # type: ignore + from ._models import GenericResource # type: ignore + from ._models import GenericResourceExpanded # type: ignore + from ._models import GenericResourceFilter # type: ignore + from ._models import HttpMessage # type: ignore + from ._models import Identity # type: ignore + from ._models import IdentityUserAssignedIdentitiesValue # type: ignore + from ._models import OnErrorDeployment # type: ignore + from ._models import OnErrorDeploymentExtended # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import ParametersLink # type: ignore + from ._models import Plan # type: ignore + from ._models import Provider # type: ignore + from ._models import ProviderListResult # type: ignore + from ._models import ProviderResourceType # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceGroup # type: ignore + from ._models import ResourceGroupExportResult # type: ignore + from ._models import ResourceGroupFilter # type: ignore + from ._models import ResourceGroupListResult # type: ignore + from ._models import ResourceGroupPatchable # type: ignore + from ._models import ResourceGroupProperties # type: ignore + from ._models import ResourceListResult # type: ignore + from ._models import ResourceProviderOperationDisplayProperties # type: ignore + from ._models import ResourceReference # type: ignore + from ._models import ResourcesMoveInfo # type: ignore + from ._models import ScopedDeployment # type: ignore + from ._models import ScopedDeploymentWhatIf # type: ignore + from ._models import Sku # type: ignore + from ._models import StatusMessage # type: ignore + from ._models import SubResource # type: ignore + from ._models import TagCount # type: ignore + from ._models import TagDetails # type: ignore + from ._models import TagValue # type: ignore + from ._models import Tags # type: ignore + from ._models import TagsListResult # type: ignore + from ._models import TagsPatchResource # type: ignore + from ._models import TagsResource # type: ignore + from ._models import TargetResource # type: ignore + from ._models import TemplateHashResult # type: ignore + from ._models import TemplateLink # type: ignore + from ._models import WhatIfChange # type: ignore + from ._models import WhatIfOperationResult # type: ignore + from ._models import WhatIfPropertyChange # type: ignore + +from ._resource_management_client_enums import ( + AliasPathAttributes, + AliasPathTokenType, + AliasPatternType, + AliasType, + ChangeType, + DeploymentMode, + OnErrorDeploymentType, + PropertyChangeType, + ProvisioningOperation, + ProvisioningState, + ResourceIdentityType, + TagsPatchOperation, + WhatIfResultFormat, +) + +__all__ = [ + 'Alias', + 'AliasPath', + 'AliasPathMetadata', + 'AliasPattern', + 'ApiProfile', + 'BasicDependency', + 'DebugSetting', + 'Dependency', + 'Deployment', + 'DeploymentExportResult', + 'DeploymentExtended', + 'DeploymentExtendedFilter', + 'DeploymentListResult', + 'DeploymentOperation', + 'DeploymentOperationProperties', + 'DeploymentOperationsListResult', + 'DeploymentProperties', + 'DeploymentPropertiesExtended', + 'DeploymentValidateResult', + 'DeploymentWhatIf', + 'DeploymentWhatIfProperties', + 'DeploymentWhatIfSettings', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ExportTemplateRequest', + 'GenericResource', + 'GenericResourceExpanded', + 'GenericResourceFilter', + 'HttpMessage', + 'Identity', + 'IdentityUserAssignedIdentitiesValue', + 'OnErrorDeployment', + 'OnErrorDeploymentExtended', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'ParametersLink', + 'Plan', + 'Provider', + 'ProviderListResult', + 'ProviderResourceType', + 'Resource', + 'ResourceGroup', + 'ResourceGroupExportResult', + 'ResourceGroupFilter', + 'ResourceGroupListResult', + 'ResourceGroupPatchable', + 'ResourceGroupProperties', + 'ResourceListResult', + 'ResourceProviderOperationDisplayProperties', + 'ResourceReference', + 'ResourcesMoveInfo', + 'ScopedDeployment', + 'ScopedDeploymentWhatIf', + 'Sku', + 'StatusMessage', + 'SubResource', + 'TagCount', + 'TagDetails', + 'TagValue', + 'Tags', + 'TagsListResult', + 'TagsPatchResource', + 'TagsResource', + 'TargetResource', + 'TemplateHashResult', + 'TemplateLink', + 'WhatIfChange', + 'WhatIfOperationResult', + 'WhatIfPropertyChange', + 'AliasPathAttributes', + 'AliasPathTokenType', + 'AliasPatternType', + 'AliasType', + 'ChangeType', + 'DeploymentMode', + 'OnErrorDeploymentType', + 'PropertyChangeType', + 'ProvisioningOperation', + 'ProvisioningState', + 'ResourceIdentityType', + 'TagsPatchOperation', + 'WhatIfResultFormat', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py new file mode 100644 index 000000000000..179ac5d4fddc --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py @@ -0,0 +1,2445 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class Alias(msrest.serialization.Model): + """The alias type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: list[~azure.mgmt.resource.resources.v2020_06_01.models.AliasPath] + :param type: The type of the alias. Possible values include: "NotSpecified", "PlainText", + "Mask". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.AliasType + :param default_path: The default path for an alias. + :type default_path: str + :param default_pattern: The default pattern for an alias. + :type default_pattern: ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPattern + :ivar default_metadata: The default alias path metadata. Applies to the default path and to any + alias path that doesn't have metadata. + :vartype default_metadata: ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPathMetadata + """ + + _validation = { + 'default_metadata': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPath]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_path': {'key': 'defaultPath', 'type': 'str'}, + 'default_pattern': {'key': 'defaultPattern', 'type': 'AliasPattern'}, + 'default_metadata': {'key': 'defaultMetadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + **kwargs + ): + super(Alias, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.paths = kwargs.get('paths', None) + self.type = kwargs.get('type', None) + self.default_path = kwargs.get('default_path', None) + self.default_pattern = kwargs.get('default_pattern', None) + self.default_metadata = None + + +class AliasPath(msrest.serialization.Model): + """The type of the paths for alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + :param pattern: The pattern for an alias path. + :type pattern: ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPattern + :ivar metadata: The metadata of the alias path. If missing, fall back to the default metadata + of the alias. + :vartype metadata: ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPathMetadata + """ + + _validation = { + 'metadata': {'readonly': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'pattern': {'key': 'pattern', 'type': 'AliasPattern'}, + 'metadata': {'key': 'metadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.api_versions = kwargs.get('api_versions', None) + self.pattern = kwargs.get('pattern', None) + self.metadata = None + + +class AliasPathMetadata(msrest.serialization.Model): + """AliasPathMetadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the token that the alias path is referring to. Possible values include: + "NotSpecified", "Any", "String", "Object", "Array", "Integer", "Number", "Boolean". + :vartype type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPathTokenType + :ivar attributes: The attributes of the token that the alias path is referring to. Possible + values include: "None", "Modifiable". + :vartype attributes: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPathAttributes + """ + + _validation = { + 'type': {'readonly': True}, + 'attributes': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPathMetadata, self).__init__(**kwargs) + self.type = None + self.attributes = None + + +class AliasPattern(msrest.serialization.Model): + """The type of the pattern for an alias path. + + :param phrase: The alias pattern phrase. + :type phrase: str + :param variable: The alias pattern variable. + :type variable: str + :param type: The type of alias pattern. Possible values include: "NotSpecified", "Extract". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPatternType + """ + + _attribute_map = { + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'variable': {'key': 'variable', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPattern, self).__init__(**kwargs) + self.phrase = kwargs.get('phrase', None) + self.variable = kwargs.get('variable', None) + self.type = kwargs.get('type', None) + + +class ApiProfile(msrest.serialization.Model): + """ApiProfile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_version: The profile version. + :vartype profile_version: str + :ivar api_version: The API version. + :vartype api_version: str + """ + + _validation = { + 'profile_version': {'readonly': True}, + 'api_version': {'readonly': True}, + } + + _attribute_map = { + 'profile_version': {'key': 'profileVersion', 'type': 'str'}, + 'api_version': {'key': 'apiVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApiProfile, self).__init__(**kwargs) + self.profile_version = None + self.api_version = None + + +class BasicDependency(msrest.serialization.Model): + """Deployment dependency information. + + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BasicDependency, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_type = kwargs.get('resource_type', None) + self.resource_name = kwargs.get('resource_name', None) + + +class DebugSetting(msrest.serialization.Model): + """The debug setting. + + :param detail_level: Specifies the type of information to log for debugging. The permitted + values are none, requestContent, responseContent, or both requestContent and responseContent + separated by a comma. The default is none. When setting this value, carefully consider the type + of information you are passing in during deployment. By logging information about the request + or response, you could potentially expose sensitive data that is retrieved through the + deployment operations. + :type detail_level: str + """ + + _attribute_map = { + 'detail_level': {'key': 'detailLevel', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DebugSetting, self).__init__(**kwargs) + self.detail_level = kwargs.get('detail_level', None) + + +class Dependency(msrest.serialization.Model): + """Deployment dependency information. + + :param depends_on: The list of dependencies. + :type depends_on: list[~azure.mgmt.resource.resources.v2020_06_01.models.BasicDependency] + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[BasicDependency]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Dependency, self).__init__(**kwargs) + self.depends_on = kwargs.get('depends_on', None) + self.id = kwargs.get('id', None) + self.resource_type = kwargs.get('resource_type', None) + self.resource_name = kwargs.get('resource_name', None) + + +class Deployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentProperties + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Deployment, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.properties = kwargs['properties'] + self.tags = kwargs.get('tags', None) + + +class DeploymentExportResult(msrest.serialization.Model): + """The deployment export result. + + :param template: The template content. + :type template: object + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentExportResult, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + + +class DeploymentExtended(msrest.serialization.Model): + """Deployment information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :param location: the location of the deployment. + :type location: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentPropertiesExtended + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentExtended, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) + self.tags = kwargs.get('tags', None) + + +class DeploymentExtendedFilter(msrest.serialization.Model): + """Deployment filter. + + :param provisioning_state: The provisioning state. + :type provisioning_state: str + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentExtendedFilter, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class DeploymentListResult(msrest.serialization.Model): + """List of deployments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployments. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentExtended]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DeploymentOperation(msrest.serialization.Model): + """Deployment operation information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full deployment operation ID. + :vartype id: str + :ivar operation_id: Deployment operation ID. + :vartype operation_id: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'operation_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentOperationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperation, self).__init__(**kwargs) + self.id = None + self.operation_id = None + self.properties = kwargs.get('properties', None) + + +class DeploymentOperationProperties(msrest.serialization.Model): + """Deployment operation properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_operation: The name of the current provisioning operation. Possible values + include: "NotSpecified", "Create", "Delete", "Waiting", "AzureAsyncOperationWaiting", + "ResourceCacheWaiting", "Action", "Read", "EvaluateDeploymentOutput", "DeploymentCleanup". + :vartype provisioning_operation: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.ProvisioningOperation + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar timestamp: The date and time of the operation. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the operation. + :vartype duration: str + :ivar service_request_id: Deployment operation service request id. + :vartype service_request_id: str + :ivar status_code: Operation status code from the resource provider. This property may not be + set if a response has not yet been received. + :vartype status_code: str + :ivar status_message: Operation status message from the resource provider. This property is + optional. It will only be provided if an error was received from the resource provider. + :vartype status_message: ~azure.mgmt.resource.resources.v2020_06_01.models.StatusMessage + :ivar target_resource: The target resource. + :vartype target_resource: ~azure.mgmt.resource.resources.v2020_06_01.models.TargetResource + :ivar request: The HTTP request message. + :vartype request: ~azure.mgmt.resource.resources.v2020_06_01.models.HttpMessage + :ivar response: The HTTP response message. + :vartype response: ~azure.mgmt.resource.resources.v2020_06_01.models.HttpMessage + """ + + _validation = { + 'provisioning_operation': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'service_request_id': {'readonly': True}, + 'status_code': {'readonly': True}, + 'status_message': {'readonly': True}, + 'target_resource': {'readonly': True}, + 'request': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_operation': {'key': 'provisioningOperation', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'service_request_id': {'key': 'serviceRequestId', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'StatusMessage'}, + 'target_resource': {'key': 'targetResource', 'type': 'TargetResource'}, + 'request': {'key': 'request', 'type': 'HttpMessage'}, + 'response': {'key': 'response', 'type': 'HttpMessage'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperationProperties, self).__init__(**kwargs) + self.provisioning_operation = None + self.provisioning_state = None + self.timestamp = None + self.duration = None + self.service_request_id = None + self.status_code = None + self.status_message = None + self.target_resource = None + self.request = None + self.response = None + + +class DeploymentOperationsListResult(msrest.serialization.Model): + """List of deployment operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployment operations. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperationsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DeploymentProperties(msrest.serialization.Model): + """Deployment properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2020_06_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeployment + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentProperties, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + self.template_link = kwargs.get('template_link', None) + self.parameters = kwargs.get('parameters', None) + self.parameters_link = kwargs.get('parameters_link', None) + self.mode = kwargs['mode'] + self.debug_setting = kwargs.get('debug_setting', None) + self.on_error_deployment = kwargs.get('on_error_deployment', None) + + +class DeploymentPropertiesExtended(msrest.serialization.Model): + """Deployment properties with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Denotes the state of provisioning. Possible values include: + "NotSpecified", "Accepted", "Running", "Ready", "Creating", "Created", "Deleting", "Deleted", + "Canceled", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.ProvisioningState + :ivar correlation_id: The correlation ID of the deployment. + :vartype correlation_id: str + :ivar timestamp: The timestamp of the template deployment. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the template deployment. + :vartype duration: str + :ivar outputs: Key/value pairs that represent deployment output. + :vartype outputs: object + :ivar providers: The list of resource providers needed for the deployment. + :vartype providers: list[~azure.mgmt.resource.resources.v2020_06_01.models.Provider] + :ivar dependencies: The list of deployment dependencies. + :vartype dependencies: list[~azure.mgmt.resource.resources.v2020_06_01.models.Dependency] + :ivar template_link: The URI referencing the template. + :vartype template_link: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateLink + :ivar parameters: Deployment parameters. + :vartype parameters: object + :ivar parameters_link: The URI referencing the parameters. + :vartype parameters_link: ~azure.mgmt.resource.resources.v2020_06_01.models.ParametersLink + :ivar mode: The deployment mode. Possible values are Incremental and Complete. Possible values + include: "Incremental", "Complete". + :vartype mode: str or ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentMode + :ivar debug_setting: The debug setting of the deployment. + :vartype debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting + :ivar on_error_deployment: The deployment on error behavior. + :vartype on_error_deployment: + ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeploymentExtended + :ivar template_hash: The hash produced for the template. + :vartype template_hash: str + :ivar output_resources: Array of provisioned resources. + :vartype output_resources: + list[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceReference] + :ivar validated_resources: Array of validated resources. + :vartype validated_resources: + list[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceReference] + :ivar error: The deployment error. + :vartype error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'outputs': {'readonly': True}, + 'providers': {'readonly': True}, + 'dependencies': {'readonly': True}, + 'template_link': {'readonly': True}, + 'parameters': {'readonly': True}, + 'parameters_link': {'readonly': True}, + 'mode': {'readonly': True}, + 'debug_setting': {'readonly': True}, + 'on_error_deployment': {'readonly': True}, + 'template_hash': {'readonly': True}, + 'output_resources': {'readonly': True}, + 'validated_resources': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'outputs': {'key': 'outputs', 'type': 'object'}, + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'dependencies': {'key': 'dependencies', 'type': '[Dependency]'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeploymentExtended'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + 'output_resources': {'key': 'outputResources', 'type': '[ResourceReference]'}, + 'validated_resources': {'key': 'validatedResources', 'type': '[ResourceReference]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentPropertiesExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.correlation_id = None + self.timestamp = None + self.duration = None + self.outputs = None + self.providers = None + self.dependencies = None + self.template_link = None + self.parameters = None + self.parameters_link = None + self.mode = None + self.debug_setting = None + self.on_error_deployment = None + self.template_hash = None + self.output_resources = None + self.validated_resources = None + self.error = None + + +class DeploymentValidateResult(msrest.serialization.Model): + """Information from validate template deployment response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The deployment validation error. + :vartype error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + :param properties: The template deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentPropertiesExtended + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentValidateResult, self).__init__(**kwargs) + self.error = None + self.properties = kwargs.get('properties', None) + + +class DeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentWhatIf, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.properties = kwargs['properties'] + + +class DeploymentWhatIfProperties(DeploymentProperties): + """Deployment What-if properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2020_06_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeployment + :param what_if_settings: Optional What-If operation settings. + :type what_if_settings: + ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIfSettings + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentWhatIfProperties, self).__init__(**kwargs) + self.what_if_settings = kwargs.get('what_if_settings', None) + + +class DeploymentWhatIfSettings(msrest.serialization.Model): + """Deployment What-If operation settings. + + :param result_format: The format of the What-If results. Possible values include: + "ResourceIdOnly", "FullResourcePayloads". + :type result_format: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfResultFormat + """ + + _attribute_map = { + 'result_format': {'key': 'resultFormat', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentWhatIfSettings, self).__init__(**kwargs) + self.result_format = kwargs.get('result_format', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2020_06_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ExportTemplateRequest(msrest.serialization.Model): + """Export resource group template request parameters. + + :param resources: The IDs of the resources to filter the export by. To export all resources, + supply an array with single entry '*'. + :type resources: list[str] + :param options: The export template options. A CSV-formatted list containing zero or more of + the following: 'IncludeParameterDefaultValue', 'IncludeComments', + 'SkipResourceNameParameterization', 'SkipAllParameterization'. + :type options: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'options': {'key': 'options', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportTemplateRequest, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.options = kwargs.get('options', None) + + +class Resource(msrest.serialization.Model): + """Specified resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2020_06_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2020_06_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2020_06_01.models.Identity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + } + + def __init__( + self, + **kwargs + ): + super(GenericResource, self).__init__(**kwargs) + self.plan = kwargs.get('plan', None) + self.properties = kwargs.get('properties', None) + self.kind = kwargs.get('kind', None) + self.managed_by = kwargs.get('managed_by', None) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + + +class GenericResourceExpanded(GenericResource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2020_06_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2020_06_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2020_06_01.models.Identity + :ivar created_time: The created time of the resource. This is only present if requested via the + $expand query parameter. + :vartype created_time: ~datetime.datetime + :ivar changed_time: The changed time of the resource. This is only present if requested via the + $expand query parameter. + :vartype changed_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the resource. This is only present if + requested via the $expand query parameter. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'created_time': {'readonly': True}, + 'changed_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'changed_time': {'key': 'changedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GenericResourceExpanded, self).__init__(**kwargs) + self.created_time = None + self.changed_time = None + self.provisioning_state = None + + +class GenericResourceFilter(msrest.serialization.Model): + """Resource filter. + + :param resource_type: The resource type. + :type resource_type: str + :param tagname: The tag name. + :type tagname: str + :param tagvalue: The tag value. + :type tagvalue: str + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'tagname': {'key': 'tagname', 'type': 'str'}, + 'tagvalue': {'key': 'tagvalue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GenericResourceFilter, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.tagname = kwargs.get('tagname', None) + self.tagvalue = kwargs.get('tagvalue', None) + + +class HttpMessage(msrest.serialization.Model): + """HTTP message. + + :param content: HTTP message content. + :type content: object + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(HttpMessage, self).__init__(**kwargs) + self.content = kwargs.get('content', None) + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2020_06_01.models.IdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{IdentityUserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class IdentityUserAssignedIdentitiesValue(msrest.serialization.Model): + """IdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class OnErrorDeployment(msrest.serialization.Model): + """Deployment on error behavior. + + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OnErrorDeployment, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.deployment_name = kwargs.get('deployment_name', None) + + +class OnErrorDeploymentExtended(msrest.serialization.Model): + """Deployment on error behavior with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning for the on error deployment. + :vartype provisioning_state: str + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OnErrorDeploymentExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.type = kwargs.get('type', None) + self.deployment_name = kwargs.get('deployment_name', None) + + +class Operation(msrest.serialization.Model): + """Microsoft.Resources operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.resources.v2020_06_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Resources. + :type provider: str + :param resource: Resource on which the operation is performed: Profile, endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Resources operations. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ParametersLink(msrest.serialization.Model): + """Entity representing the reference to the deployment parameters. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the parameters file. + :type uri: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ParametersLink, self).__init__(**kwargs) + self.uri = kwargs['uri'] + self.content_version = kwargs.get('content_version', None) + + +class Plan(msrest.serialization.Model): + """Plan for the resource. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: The offer ID. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + :param version: The plan's version. + :type version: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.publisher = kwargs.get('publisher', None) + self.product = kwargs.get('product', None) + self.promotion_code = kwargs.get('promotion_code', None) + self.version = kwargs.get('version', None) + + +class Provider(msrest.serialization.Model): + """Resource provider information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The provider ID. + :vartype id: str + :param namespace: The namespace of the resource provider. + :type namespace: str + :ivar registration_state: The registration state of the resource provider. + :vartype registration_state: str + :ivar registration_policy: The registration policy of the resource provider. + :vartype registration_policy: str + :ivar resource_types: The collection of provider resource types. + :vartype resource_types: + list[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderResourceType] + """ + + _validation = { + 'id': {'readonly': True}, + 'registration_state': {'readonly': True}, + 'registration_policy': {'readonly': True}, + 'resource_types': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'registration_policy': {'key': 'registrationPolicy', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ProviderResourceType]'}, + } + + def __init__( + self, + **kwargs + ): + super(Provider, self).__init__(**kwargs) + self.id = None + self.namespace = kwargs.get('namespace', None) + self.registration_state = None + self.registration_policy = None + self.resource_types = None + + +class ProviderListResult(msrest.serialization.Model): + """List of resource providers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource providers. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.Provider] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Provider]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ProviderResourceType(msrest.serialization.Model): + """Resource type managed by the resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param resource_type: The resource type. + :type resource_type: str + :param locations: The collection of locations where this resource type can be created. + :type locations: list[str] + :param aliases: The aliases that are supported by this resource type. + :type aliases: list[~azure.mgmt.resource.resources.v2020_06_01.models.Alias] + :param api_versions: The API version. + :type api_versions: list[str] + :ivar default_api_version: The default API version. + :vartype default_api_version: str + :ivar api_profiles: The API profiles for the resource provider. + :vartype api_profiles: list[~azure.mgmt.resource.resources.v2020_06_01.models.ApiProfile] + :param capabilities: The additional capabilities offered by this resource type. + :type capabilities: str + :param properties: The properties. + :type properties: dict[str, str] + """ + + _validation = { + 'default_api_version': {'readonly': True}, + 'api_profiles': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'aliases': {'key': 'aliases', 'type': '[Alias]'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'default_api_version': {'key': 'defaultApiVersion', 'type': 'str'}, + 'api_profiles': {'key': 'apiProfiles', 'type': '[ApiProfile]'}, + 'capabilities': {'key': 'capabilities', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderResourceType, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.locations = kwargs.get('locations', None) + self.aliases = kwargs.get('aliases', None) + self.api_versions = kwargs.get('api_versions', None) + self.default_api_version = None + self.api_profiles = None + self.capabilities = kwargs.get('capabilities', None) + self.properties = kwargs.get('properties', None) + + +class ResourceGroup(msrest.serialization.Model): + """Resource group information. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the resource group. + :vartype id: str + :ivar name: The name of the resource group. + :vartype name: str + :ivar type: The type of the resource group. + :vartype type: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupProperties + :param location: Required. The location of the resource group. It cannot be changed after the + resource group has been created. It must be one of the supported Azure locations. + :type location: str + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroup, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + self.location = kwargs['location'] + self.managed_by = kwargs.get('managed_by', None) + self.tags = kwargs.get('tags', None) + + +class ResourceGroupExportResult(msrest.serialization.Model): + """Resource group export result. + + :param template: The template content. + :type template: object + :param error: The template export error. + :type error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupExportResult, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + self.error = kwargs.get('error', None) + + +class ResourceGroupFilter(msrest.serialization.Model): + """Resource group filter. + + :param tag_name: The tag name. + :type tag_name: str + :param tag_value: The tag value. + :type tag_value: str + """ + + _attribute_map = { + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupFilter, self).__init__(**kwargs) + self.tag_name = kwargs.get('tag_name', None) + self.tag_value = kwargs.get('tag_value', None) + + +class ResourceGroupListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource groups. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ResourceGroupPatchable(msrest.serialization.Model): + """Resource group information. + + :param name: The name of the resource group. + :type name: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupProperties + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupPatchable, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + self.managed_by = kwargs.get('managed_by', None) + self.tags = kwargs.get('tags', None) + + +class ResourceGroupProperties(msrest.serialization.Model): + """The resource group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class ResourceListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resources. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResourceExpanded] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GenericResourceExpanded]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ResourceProviderOperationDisplayProperties(msrest.serialization.Model): + """Resource provider operation's display properties. + + :param publisher: Operation description. + :type publisher: str + :param provider: Operation provider. + :type provider: str + :param resource: Operation resource. + :type resource: str + :param operation: Resource provider operation. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationDisplayProperties, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class ResourceReference(msrest.serialization.Model): + """The resource Id model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified resource Id. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceReference, self).__init__(**kwargs) + self.id = None + + +class ResourcesMoveInfo(msrest.serialization.Model): + """Parameters of move resources. + + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourcesMoveInfo, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.target_resource_group = kwargs.get('target_resource_group', None) + + +class ScopedDeployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentProperties + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ScopedDeployment, self).__init__(**kwargs) + self.location = kwargs['location'] + self.properties = kwargs['properties'] + self.tags = kwargs.get('tags', None) + + +class ScopedDeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ScopedDeploymentWhatIf, self).__init__(**kwargs) + self.location = kwargs['location'] + self.properties = kwargs['properties'] + + +class Sku(msrest.serialization.Model): + """SKU for the resource. + + :param name: The SKU name. + :type name: str + :param tier: The SKU tier. + :type tier: str + :param size: The SKU size. + :type size: str + :param family: The SKU family. + :type family: str + :param model: The SKU model. + :type model: str + :param capacity: The SKU capacity. + :type capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) + self.model = kwargs.get('model', None) + self.capacity = kwargs.get('capacity', None) + + +class StatusMessage(msrest.serialization.Model): + """Operation status message object. + + :param status: Status of the deployment operation. + :type status: str + :param error: The error reported by the operation. + :type error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(StatusMessage, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.error = kwargs.get('error', None) + + +class SubResource(msrest.serialization.Model): + """Sub-resource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class TagCount(msrest.serialization.Model): + """Tag count. + + :param type: Type of count. + :type type: str + :param value: Value of count. + :type value: int + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(TagCount, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.value = kwargs.get('value', None) + + +class TagDetails(msrest.serialization.Model): + """Tag details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag name ID. + :vartype id: str + :param tag_name: The tag name. + :type tag_name: str + :param count: The total number of resources that use the resource tag. When a tag is initially + created and has no associated resources, the value is 0. + :type count: ~azure.mgmt.resource.resources.v2020_06_01.models.TagCount + :param values: The list of tag values. + :type values: list[~azure.mgmt.resource.resources.v2020_06_01.models.TagValue] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + 'values': {'key': 'values', 'type': '[TagValue]'}, + } + + def __init__( + self, + **kwargs + ): + super(TagDetails, self).__init__(**kwargs) + self.id = None + self.tag_name = kwargs.get('tag_name', None) + self.count = kwargs.get('count', None) + self.values = kwargs.get('values', None) + + +class Tags(msrest.serialization.Model): + """A dictionary of name and value pairs. + + :param tags: A set of tags. Dictionary of :code:``. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Tags, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class TagsListResult(msrest.serialization.Model): + """List of subscription tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of tags. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.TagDetails] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TagDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TagsPatchResource(msrest.serialization.Model): + """Wrapper resource for tags patch API request only. + + :param operation: The operation type for the patch API. Possible values include: "Replace", + "Merge", "Delete". + :type operation: str or ~azure.mgmt.resource.resources.v2020_06_01.models.TagsPatchOperation + :param properties: The set of tags. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.Tags + """ + + _attribute_map = { + 'operation': {'key': 'operation', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'Tags'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsPatchResource, self).__init__(**kwargs) + self.operation = kwargs.get('operation', None) + self.properties = kwargs.get('properties', None) + + +class TagsResource(msrest.serialization.Model): + """Wrapper resource for tags API requests and responses. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the tags wrapper resource. + :vartype id: str + :ivar name: The name of the tags wrapper resource. + :vartype name: str + :ivar type: The type of the tags wrapper resource. + :vartype type: str + :param properties: Required. The set of tags. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.Tags + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'Tags'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class TagValue(msrest.serialization.Model): + """Tag information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag value ID. + :vartype id: str + :param tag_value: The tag value. + :type tag_value: str + :param count: The tag value count. + :type count: ~azure.mgmt.resource.resources.v2020_06_01.models.TagCount + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + } + + def __init__( + self, + **kwargs + ): + super(TagValue, self).__init__(**kwargs) + self.id = None + self.tag_value = kwargs.get('tag_value', None) + self.count = kwargs.get('count', None) + + +class TargetResource(msrest.serialization.Model): + """Target resource. + + :param id: The ID of the resource. + :type id: str + :param resource_name: The name of the resource. + :type resource_name: str + :param resource_type: The type of the resource. + :type resource_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TargetResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_name = kwargs.get('resource_name', None) + self.resource_type = kwargs.get('resource_type', None) + + +class TemplateHashResult(msrest.serialization.Model): + """Result of the request to calculate template hash. It contains a string of minified template and its hash. + + :param minified_template: The minified template string. + :type minified_template: str + :param template_hash: The template hash. + :type template_hash: str + """ + + _attribute_map = { + 'minified_template': {'key': 'minifiedTemplate', 'type': 'str'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateHashResult, self).__init__(**kwargs) + self.minified_template = kwargs.get('minified_template', None) + self.template_hash = kwargs.get('template_hash', None) + + +class TemplateLink(msrest.serialization.Model): + """Entity representing the reference to the template. + + :param uri: The URI of the template to deploy. Use either the uri or id property, but not both. + :type uri: str + :param id: The resource id of a Template Spec. Use either the id or uri property, but not both. + :type id: str + :param relative_path: Applicable only if this template link references a Template Spec. This + relativePath property can optionally be used to reference a Template Spec artifact by path. + :type relative_path: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateLink, self).__init__(**kwargs) + self.uri = kwargs.get('uri', None) + self.id = kwargs.get('id', None) + self.relative_path = kwargs.get('relative_path', None) + self.content_version = kwargs.get('content_version', None) + + +class WhatIfChange(msrest.serialization.Model): + """Information about a single resource change predicted by What-If operation. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Resource ID. + :type resource_id: str + :param change_type: Required. Type of change that will be made to the resource when the + deployment is executed. Possible values include: "Create", "Delete", "Ignore", "Deploy", + "NoChange", "Modify". + :type change_type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.ChangeType + :param before: The snapshot of the resource before the deployment is executed. + :type before: object + :param after: The predicted snapshot of the resource after the deployment is executed. + :type after: object + :param delta: The predicted changes to resource properties. + :type delta: list[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_type': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'str'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'delta': {'key': 'delta', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__( + self, + **kwargs + ): + super(WhatIfChange, self).__init__(**kwargs) + self.resource_id = kwargs['resource_id'] + self.change_type = kwargs['change_type'] + self.before = kwargs.get('before', None) + self.after = kwargs.get('after', None) + self.delta = kwargs.get('delta', None) + + +class WhatIfOperationResult(msrest.serialization.Model): + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + + :param status: Status of the What-If operation. + :type status: str + :param error: Error when What-If operation fails. + :type error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + :param changes: List of resource changes predicted by What-If operation. + :type changes: list[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfChange] + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + 'changes': {'key': 'properties.changes', 'type': '[WhatIfChange]'}, + } + + def __init__( + self, + **kwargs + ): + super(WhatIfOperationResult, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.error = kwargs.get('error', None) + self.changes = kwargs.get('changes', None) + + +class WhatIfPropertyChange(msrest.serialization.Model): + """The predicted change to the resource property. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. The path of the property. + :type path: str + :param property_change_type: Required. The type of property change. Possible values include: + "Create", "Delete", "Modify", "Array". + :type property_change_type: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.PropertyChangeType + :param before: The value of the property before the deployment is executed. + :type before: object + :param after: The value of the property after the deployment is executed. + :type after: object + :param children: Nested property changes. + :type children: list[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'path': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'str'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'children': {'key': 'children', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__( + self, + **kwargs + ): + super(WhatIfPropertyChange, self).__init__(**kwargs) + self.path = kwargs['path'] + self.property_change_type = kwargs['property_change_type'] + self.before = kwargs.get('before', None) + self.after = kwargs.get('after', None) + self.children = kwargs.get('children', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py new file mode 100644 index 000000000000..344c24cabd8f --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py @@ -0,0 +1,2681 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._resource_management_client_enums import * + + +class Alias(msrest.serialization.Model): + """The alias type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: list[~azure.mgmt.resource.resources.v2020_06_01.models.AliasPath] + :param type: The type of the alias. Possible values include: "NotSpecified", "PlainText", + "Mask". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.AliasType + :param default_path: The default path for an alias. + :type default_path: str + :param default_pattern: The default pattern for an alias. + :type default_pattern: ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPattern + :ivar default_metadata: The default alias path metadata. Applies to the default path and to any + alias path that doesn't have metadata. + :vartype default_metadata: ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPathMetadata + """ + + _validation = { + 'default_metadata': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPath]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_path': {'key': 'defaultPath', 'type': 'str'}, + 'default_pattern': {'key': 'defaultPattern', 'type': 'AliasPattern'}, + 'default_metadata': {'key': 'defaultMetadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + paths: Optional[List["AliasPath"]] = None, + type: Optional[Union[str, "AliasType"]] = None, + default_path: Optional[str] = None, + default_pattern: Optional["AliasPattern"] = None, + **kwargs + ): + super(Alias, self).__init__(**kwargs) + self.name = name + self.paths = paths + self.type = type + self.default_path = default_path + self.default_pattern = default_pattern + self.default_metadata = None + + +class AliasPath(msrest.serialization.Model): + """The type of the paths for alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + :param pattern: The pattern for an alias path. + :type pattern: ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPattern + :ivar metadata: The metadata of the alias path. If missing, fall back to the default metadata + of the alias. + :vartype metadata: ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPathMetadata + """ + + _validation = { + 'metadata': {'readonly': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'pattern': {'key': 'pattern', 'type': 'AliasPattern'}, + 'metadata': {'key': 'metadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + api_versions: Optional[List[str]] = None, + pattern: Optional["AliasPattern"] = None, + **kwargs + ): + super(AliasPath, self).__init__(**kwargs) + self.path = path + self.api_versions = api_versions + self.pattern = pattern + self.metadata = None + + +class AliasPathMetadata(msrest.serialization.Model): + """AliasPathMetadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the token that the alias path is referring to. Possible values include: + "NotSpecified", "Any", "String", "Object", "Array", "Integer", "Number", "Boolean". + :vartype type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPathTokenType + :ivar attributes: The attributes of the token that the alias path is referring to. Possible + values include: "None", "Modifiable". + :vartype attributes: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPathAttributes + """ + + _validation = { + 'type': {'readonly': True}, + 'attributes': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPathMetadata, self).__init__(**kwargs) + self.type = None + self.attributes = None + + +class AliasPattern(msrest.serialization.Model): + """The type of the pattern for an alias path. + + :param phrase: The alias pattern phrase. + :type phrase: str + :param variable: The alias pattern variable. + :type variable: str + :param type: The type of alias pattern. Possible values include: "NotSpecified", "Extract". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.AliasPatternType + """ + + _attribute_map = { + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'variable': {'key': 'variable', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + phrase: Optional[str] = None, + variable: Optional[str] = None, + type: Optional[Union[str, "AliasPatternType"]] = None, + **kwargs + ): + super(AliasPattern, self).__init__(**kwargs) + self.phrase = phrase + self.variable = variable + self.type = type + + +class ApiProfile(msrest.serialization.Model): + """ApiProfile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_version: The profile version. + :vartype profile_version: str + :ivar api_version: The API version. + :vartype api_version: str + """ + + _validation = { + 'profile_version': {'readonly': True}, + 'api_version': {'readonly': True}, + } + + _attribute_map = { + 'profile_version': {'key': 'profileVersion', 'type': 'str'}, + 'api_version': {'key': 'apiVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApiProfile, self).__init__(**kwargs) + self.profile_version = None + self.api_version = None + + +class BasicDependency(msrest.serialization.Model): + """Deployment dependency information. + + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + resource_type: Optional[str] = None, + resource_name: Optional[str] = None, + **kwargs + ): + super(BasicDependency, self).__init__(**kwargs) + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class DebugSetting(msrest.serialization.Model): + """The debug setting. + + :param detail_level: Specifies the type of information to log for debugging. The permitted + values are none, requestContent, responseContent, or both requestContent and responseContent + separated by a comma. The default is none. When setting this value, carefully consider the type + of information you are passing in during deployment. By logging information about the request + or response, you could potentially expose sensitive data that is retrieved through the + deployment operations. + :type detail_level: str + """ + + _attribute_map = { + 'detail_level': {'key': 'detailLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + detail_level: Optional[str] = None, + **kwargs + ): + super(DebugSetting, self).__init__(**kwargs) + self.detail_level = detail_level + + +class Dependency(msrest.serialization.Model): + """Deployment dependency information. + + :param depends_on: The list of dependencies. + :type depends_on: list[~azure.mgmt.resource.resources.v2020_06_01.models.BasicDependency] + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[BasicDependency]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + *, + depends_on: Optional[List["BasicDependency"]] = None, + id: Optional[str] = None, + resource_type: Optional[str] = None, + resource_name: Optional[str] = None, + **kwargs + ): + super(Dependency, self).__init__(**kwargs) + self.depends_on = depends_on + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class Deployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentProperties + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + properties: "DeploymentProperties", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Deployment, self).__init__(**kwargs) + self.location = location + self.properties = properties + self.tags = tags + + +class DeploymentExportResult(msrest.serialization.Model): + """The deployment export result. + + :param template: The template content. + :type template: object + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__( + self, + *, + template: Optional[object] = None, + **kwargs + ): + super(DeploymentExportResult, self).__init__(**kwargs) + self.template = template + + +class DeploymentExtended(msrest.serialization.Model): + """Deployment information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :param location: the location of the deployment. + :type location: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentPropertiesExtended + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + properties: Optional["DeploymentPropertiesExtended"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(DeploymentExtended, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.properties = properties + self.tags = tags + + +class DeploymentExtendedFilter(msrest.serialization.Model): + """Deployment filter. + + :param provisioning_state: The provisioning state. + :type provisioning_state: str + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[str] = None, + **kwargs + ): + super(DeploymentExtendedFilter, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + + +class DeploymentListResult(msrest.serialization.Model): + """List of deployments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployments. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentExtended]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentExtended"]] = None, + **kwargs + ): + super(DeploymentListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeploymentOperation(msrest.serialization.Model): + """Deployment operation information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full deployment operation ID. + :vartype id: str + :ivar operation_id: Deployment operation ID. + :vartype operation_id: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'operation_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentOperationProperties'}, + } + + def __init__( + self, + *, + properties: Optional["DeploymentOperationProperties"] = None, + **kwargs + ): + super(DeploymentOperation, self).__init__(**kwargs) + self.id = None + self.operation_id = None + self.properties = properties + + +class DeploymentOperationProperties(msrest.serialization.Model): + """Deployment operation properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_operation: The name of the current provisioning operation. Possible values + include: "NotSpecified", "Create", "Delete", "Waiting", "AzureAsyncOperationWaiting", + "ResourceCacheWaiting", "Action", "Read", "EvaluateDeploymentOutput", "DeploymentCleanup". + :vartype provisioning_operation: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.ProvisioningOperation + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar timestamp: The date and time of the operation. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the operation. + :vartype duration: str + :ivar service_request_id: Deployment operation service request id. + :vartype service_request_id: str + :ivar status_code: Operation status code from the resource provider. This property may not be + set if a response has not yet been received. + :vartype status_code: str + :ivar status_message: Operation status message from the resource provider. This property is + optional. It will only be provided if an error was received from the resource provider. + :vartype status_message: ~azure.mgmt.resource.resources.v2020_06_01.models.StatusMessage + :ivar target_resource: The target resource. + :vartype target_resource: ~azure.mgmt.resource.resources.v2020_06_01.models.TargetResource + :ivar request: The HTTP request message. + :vartype request: ~azure.mgmt.resource.resources.v2020_06_01.models.HttpMessage + :ivar response: The HTTP response message. + :vartype response: ~azure.mgmt.resource.resources.v2020_06_01.models.HttpMessage + """ + + _validation = { + 'provisioning_operation': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'service_request_id': {'readonly': True}, + 'status_code': {'readonly': True}, + 'status_message': {'readonly': True}, + 'target_resource': {'readonly': True}, + 'request': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_operation': {'key': 'provisioningOperation', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'service_request_id': {'key': 'serviceRequestId', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'StatusMessage'}, + 'target_resource': {'key': 'targetResource', 'type': 'TargetResource'}, + 'request': {'key': 'request', 'type': 'HttpMessage'}, + 'response': {'key': 'response', 'type': 'HttpMessage'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperationProperties, self).__init__(**kwargs) + self.provisioning_operation = None + self.provisioning_state = None + self.timestamp = None + self.duration = None + self.service_request_id = None + self.status_code = None + self.status_message = None + self.target_resource = None + self.request = None + self.response = None + + +class DeploymentOperationsListResult(msrest.serialization.Model): + """List of deployment operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployment operations. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentOperation"]] = None, + **kwargs + ): + super(DeploymentOperationsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeploymentProperties(msrest.serialization.Model): + """Deployment properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2020_06_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeployment + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + } + + def __init__( + self, + *, + mode: Union[str, "DeploymentMode"], + template: Optional[object] = None, + template_link: Optional["TemplateLink"] = None, + parameters: Optional[object] = None, + parameters_link: Optional["ParametersLink"] = None, + debug_setting: Optional["DebugSetting"] = None, + on_error_deployment: Optional["OnErrorDeployment"] = None, + **kwargs + ): + super(DeploymentProperties, self).__init__(**kwargs) + self.template = template + self.template_link = template_link + self.parameters = parameters + self.parameters_link = parameters_link + self.mode = mode + self.debug_setting = debug_setting + self.on_error_deployment = on_error_deployment + + +class DeploymentPropertiesExtended(msrest.serialization.Model): + """Deployment properties with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Denotes the state of provisioning. Possible values include: + "NotSpecified", "Accepted", "Running", "Ready", "Creating", "Created", "Deleting", "Deleted", + "Canceled", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.ProvisioningState + :ivar correlation_id: The correlation ID of the deployment. + :vartype correlation_id: str + :ivar timestamp: The timestamp of the template deployment. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the template deployment. + :vartype duration: str + :ivar outputs: Key/value pairs that represent deployment output. + :vartype outputs: object + :ivar providers: The list of resource providers needed for the deployment. + :vartype providers: list[~azure.mgmt.resource.resources.v2020_06_01.models.Provider] + :ivar dependencies: The list of deployment dependencies. + :vartype dependencies: list[~azure.mgmt.resource.resources.v2020_06_01.models.Dependency] + :ivar template_link: The URI referencing the template. + :vartype template_link: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateLink + :ivar parameters: Deployment parameters. + :vartype parameters: object + :ivar parameters_link: The URI referencing the parameters. + :vartype parameters_link: ~azure.mgmt.resource.resources.v2020_06_01.models.ParametersLink + :ivar mode: The deployment mode. Possible values are Incremental and Complete. Possible values + include: "Incremental", "Complete". + :vartype mode: str or ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentMode + :ivar debug_setting: The debug setting of the deployment. + :vartype debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting + :ivar on_error_deployment: The deployment on error behavior. + :vartype on_error_deployment: + ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeploymentExtended + :ivar template_hash: The hash produced for the template. + :vartype template_hash: str + :ivar output_resources: Array of provisioned resources. + :vartype output_resources: + list[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceReference] + :ivar validated_resources: Array of validated resources. + :vartype validated_resources: + list[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceReference] + :ivar error: The deployment error. + :vartype error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'outputs': {'readonly': True}, + 'providers': {'readonly': True}, + 'dependencies': {'readonly': True}, + 'template_link': {'readonly': True}, + 'parameters': {'readonly': True}, + 'parameters_link': {'readonly': True}, + 'mode': {'readonly': True}, + 'debug_setting': {'readonly': True}, + 'on_error_deployment': {'readonly': True}, + 'template_hash': {'readonly': True}, + 'output_resources': {'readonly': True}, + 'validated_resources': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'outputs': {'key': 'outputs', 'type': 'object'}, + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'dependencies': {'key': 'dependencies', 'type': '[Dependency]'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeploymentExtended'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + 'output_resources': {'key': 'outputResources', 'type': '[ResourceReference]'}, + 'validated_resources': {'key': 'validatedResources', 'type': '[ResourceReference]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentPropertiesExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.correlation_id = None + self.timestamp = None + self.duration = None + self.outputs = None + self.providers = None + self.dependencies = None + self.template_link = None + self.parameters = None + self.parameters_link = None + self.mode = None + self.debug_setting = None + self.on_error_deployment = None + self.template_hash = None + self.output_resources = None + self.validated_resources = None + self.error = None + + +class DeploymentValidateResult(msrest.serialization.Model): + """Information from validate template deployment response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The deployment validation error. + :vartype error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + :param properties: The template deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentPropertiesExtended + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__( + self, + *, + properties: Optional["DeploymentPropertiesExtended"] = None, + **kwargs + ): + super(DeploymentValidateResult, self).__init__(**kwargs) + self.error = None + self.properties = properties + + +class DeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + *, + properties: "DeploymentWhatIfProperties", + location: Optional[str] = None, + **kwargs + ): + super(DeploymentWhatIf, self).__init__(**kwargs) + self.location = location + self.properties = properties + + +class DeploymentWhatIfProperties(DeploymentProperties): + """Deployment What-if properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2020_06_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeployment + :param what_if_settings: Optional What-If operation settings. + :type what_if_settings: + ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIfSettings + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, + } + + def __init__( + self, + *, + mode: Union[str, "DeploymentMode"], + template: Optional[object] = None, + template_link: Optional["TemplateLink"] = None, + parameters: Optional[object] = None, + parameters_link: Optional["ParametersLink"] = None, + debug_setting: Optional["DebugSetting"] = None, + on_error_deployment: Optional["OnErrorDeployment"] = None, + what_if_settings: Optional["DeploymentWhatIfSettings"] = None, + **kwargs + ): + super(DeploymentWhatIfProperties, self).__init__(template=template, template_link=template_link, parameters=parameters, parameters_link=parameters_link, mode=mode, debug_setting=debug_setting, on_error_deployment=on_error_deployment, **kwargs) + self.what_if_settings = what_if_settings + + +class DeploymentWhatIfSettings(msrest.serialization.Model): + """Deployment What-If operation settings. + + :param result_format: The format of the What-If results. Possible values include: + "ResourceIdOnly", "FullResourcePayloads". + :type result_format: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfResultFormat + """ + + _attribute_map = { + 'result_format': {'key': 'resultFormat', 'type': 'str'}, + } + + def __init__( + self, + *, + result_format: Optional[Union[str, "WhatIfResultFormat"]] = None, + **kwargs + ): + super(DeploymentWhatIfSettings, self).__init__(**kwargs) + self.result_format = result_format + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2020_06_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ExportTemplateRequest(msrest.serialization.Model): + """Export resource group template request parameters. + + :param resources: The IDs of the resources to filter the export by. To export all resources, + supply an array with single entry '*'. + :type resources: list[str] + :param options: The export template options. A CSV-formatted list containing zero or more of + the following: 'IncludeParameterDefaultValue', 'IncludeComments', + 'SkipResourceNameParameterization', 'SkipAllParameterization'. + :type options: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'options': {'key': 'options', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[List[str]] = None, + options: Optional[str] = None, + **kwargs + ): + super(ExportTemplateRequest, self).__init__(**kwargs) + self.resources = resources + self.options = options + + +class Resource(msrest.serialization.Model): + """Specified resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2020_06_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2020_06_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2020_06_01.models.Identity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + properties: Optional[object] = None, + kind: Optional[str] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + identity: Optional["Identity"] = None, + **kwargs + ): + super(GenericResource, self).__init__(location=location, tags=tags, **kwargs) + self.plan = plan + self.properties = properties + self.kind = kind + self.managed_by = managed_by + self.sku = sku + self.identity = identity + + +class GenericResourceExpanded(GenericResource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2020_06_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2020_06_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2020_06_01.models.Identity + :ivar created_time: The created time of the resource. This is only present if requested via the + $expand query parameter. + :vartype created_time: ~datetime.datetime + :ivar changed_time: The changed time of the resource. This is only present if requested via the + $expand query parameter. + :vartype changed_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the resource. This is only present if + requested via the $expand query parameter. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'created_time': {'readonly': True}, + 'changed_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'changed_time': {'key': 'changedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + properties: Optional[object] = None, + kind: Optional[str] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + identity: Optional["Identity"] = None, + **kwargs + ): + super(GenericResourceExpanded, self).__init__(location=location, tags=tags, plan=plan, properties=properties, kind=kind, managed_by=managed_by, sku=sku, identity=identity, **kwargs) + self.created_time = None + self.changed_time = None + self.provisioning_state = None + + +class GenericResourceFilter(msrest.serialization.Model): + """Resource filter. + + :param resource_type: The resource type. + :type resource_type: str + :param tagname: The tag name. + :type tagname: str + :param tagvalue: The tag value. + :type tagvalue: str + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'tagname': {'key': 'tagname', 'type': 'str'}, + 'tagvalue': {'key': 'tagvalue', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + tagname: Optional[str] = None, + tagvalue: Optional[str] = None, + **kwargs + ): + super(GenericResourceFilter, self).__init__(**kwargs) + self.resource_type = resource_type + self.tagname = tagname + self.tagvalue = tagvalue + + +class HttpMessage(msrest.serialization.Model): + """HTTP message. + + :param content: HTTP message content. + :type content: object + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__( + self, + *, + content: Optional[object] = None, + **kwargs + ): + super(HttpMessage, self).__init__(**kwargs) + self.content = content + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2020_06_01.models.IdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{IdentityUserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "IdentityUserAssignedIdentitiesValue"]] = None, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class IdentityUserAssignedIdentitiesValue(msrest.serialization.Model): + """IdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class OnErrorDeployment(msrest.serialization.Model): + """Deployment on error behavior. + + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "OnErrorDeploymentType"]] = None, + deployment_name: Optional[str] = None, + **kwargs + ): + super(OnErrorDeployment, self).__init__(**kwargs) + self.type = type + self.deployment_name = deployment_name + + +class OnErrorDeploymentExtended(msrest.serialization.Model): + """Deployment on error behavior with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning for the on error deployment. + :vartype provisioning_state: str + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "OnErrorDeploymentType"]] = None, + deployment_name: Optional[str] = None, + **kwargs + ): + super(OnErrorDeploymentExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.type = type + self.deployment_name = deployment_name + + +class Operation(msrest.serialization.Model): + """Microsoft.Resources operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.resources.v2020_06_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Resources. + :type provider: str + :param resource: Resource on which the operation is performed: Profile, endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Resources operations. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ParametersLink(msrest.serialization.Model): + """Entity representing the reference to the deployment parameters. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the parameters file. + :type uri: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: str, + content_version: Optional[str] = None, + **kwargs + ): + super(ParametersLink, self).__init__(**kwargs) + self.uri = uri + self.content_version = content_version + + +class Plan(msrest.serialization.Model): + """Plan for the resource. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: The offer ID. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + :param version: The plan's version. + :type version: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class Provider(msrest.serialization.Model): + """Resource provider information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The provider ID. + :vartype id: str + :param namespace: The namespace of the resource provider. + :type namespace: str + :ivar registration_state: The registration state of the resource provider. + :vartype registration_state: str + :ivar registration_policy: The registration policy of the resource provider. + :vartype registration_policy: str + :ivar resource_types: The collection of provider resource types. + :vartype resource_types: + list[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderResourceType] + """ + + _validation = { + 'id': {'readonly': True}, + 'registration_state': {'readonly': True}, + 'registration_policy': {'readonly': True}, + 'resource_types': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'registration_policy': {'key': 'registrationPolicy', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ProviderResourceType]'}, + } + + def __init__( + self, + *, + namespace: Optional[str] = None, + **kwargs + ): + super(Provider, self).__init__(**kwargs) + self.id = None + self.namespace = namespace + self.registration_state = None + self.registration_policy = None + self.resource_types = None + + +class ProviderListResult(msrest.serialization.Model): + """List of resource providers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource providers. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.Provider] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Provider]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Provider"]] = None, + **kwargs + ): + super(ProviderListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProviderResourceType(msrest.serialization.Model): + """Resource type managed by the resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param resource_type: The resource type. + :type resource_type: str + :param locations: The collection of locations where this resource type can be created. + :type locations: list[str] + :param aliases: The aliases that are supported by this resource type. + :type aliases: list[~azure.mgmt.resource.resources.v2020_06_01.models.Alias] + :param api_versions: The API version. + :type api_versions: list[str] + :ivar default_api_version: The default API version. + :vartype default_api_version: str + :ivar api_profiles: The API profiles for the resource provider. + :vartype api_profiles: list[~azure.mgmt.resource.resources.v2020_06_01.models.ApiProfile] + :param capabilities: The additional capabilities offered by this resource type. + :type capabilities: str + :param properties: The properties. + :type properties: dict[str, str] + """ + + _validation = { + 'default_api_version': {'readonly': True}, + 'api_profiles': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'aliases': {'key': 'aliases', 'type': '[Alias]'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'default_api_version': {'key': 'defaultApiVersion', 'type': 'str'}, + 'api_profiles': {'key': 'apiProfiles', 'type': '[ApiProfile]'}, + 'capabilities': {'key': 'capabilities', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + locations: Optional[List[str]] = None, + aliases: Optional[List["Alias"]] = None, + api_versions: Optional[List[str]] = None, + capabilities: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ProviderResourceType, self).__init__(**kwargs) + self.resource_type = resource_type + self.locations = locations + self.aliases = aliases + self.api_versions = api_versions + self.default_api_version = None + self.api_profiles = None + self.capabilities = capabilities + self.properties = properties + + +class ResourceGroup(msrest.serialization.Model): + """Resource group information. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the resource group. + :vartype id: str + :ivar name: The name of the resource group. + :vartype name: str + :ivar type: The type of the resource group. + :vartype type: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupProperties + :param location: Required. The location of the resource group. It cannot be changed after the + resource group has been created. It must be one of the supported Azure locations. + :type location: str + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + properties: Optional["ResourceGroupProperties"] = None, + managed_by: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceGroup, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + self.location = location + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupExportResult(msrest.serialization.Model): + """Resource group export result. + + :param template: The template content. + :type template: object + :param error: The template export error. + :type error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + *, + template: Optional[object] = None, + error: Optional["ErrorResponse"] = None, + **kwargs + ): + super(ResourceGroupExportResult, self).__init__(**kwargs) + self.template = template + self.error = error + + +class ResourceGroupFilter(msrest.serialization.Model): + """Resource group filter. + + :param tag_name: The tag name. + :type tag_name: str + :param tag_value: The tag value. + :type tag_value: str + """ + + _attribute_map = { + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + } + + def __init__( + self, + *, + tag_name: Optional[str] = None, + tag_value: Optional[str] = None, + **kwargs + ): + super(ResourceGroupFilter, self).__init__(**kwargs) + self.tag_name = tag_name + self.tag_value = tag_value + + +class ResourceGroupListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource groups. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceGroup"]] = None, + **kwargs + ): + super(ResourceGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceGroupPatchable(msrest.serialization.Model): + """Resource group information. + + :param name: The name of the resource group. + :type name: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupProperties + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["ResourceGroupProperties"] = None, + managed_by: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceGroupPatchable, self).__init__(**kwargs) + self.name = name + self.properties = properties + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupProperties(msrest.serialization.Model): + """The resource group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class ResourceListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resources. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResourceExpanded] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GenericResourceExpanded]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["GenericResourceExpanded"]] = None, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceProviderOperationDisplayProperties(msrest.serialization.Model): + """Resource provider operation's display properties. + + :param publisher: Operation description. + :type publisher: str + :param provider: Operation provider. + :type provider: str + :param resource: Operation resource. + :type resource: str + :param operation: Resource provider operation. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(ResourceProviderOperationDisplayProperties, self).__init__(**kwargs) + self.publisher = publisher + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceReference(msrest.serialization.Model): + """The resource Id model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified resource Id. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceReference, self).__init__(**kwargs) + self.id = None + + +class ResourcesMoveInfo(msrest.serialization.Model): + """Parameters of move resources. + + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[List[str]] = None, + target_resource_group: Optional[str] = None, + **kwargs + ): + super(ResourcesMoveInfo, self).__init__(**kwargs) + self.resources = resources + self.target_resource_group = target_resource_group + + +class ScopedDeployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentProperties + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + properties: "DeploymentProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ScopedDeployment, self).__init__(**kwargs) + self.location = location + self.properties = properties + self.tags = tags + + +class ScopedDeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + *, + location: str, + properties: "DeploymentWhatIfProperties", + **kwargs + ): + super(ScopedDeploymentWhatIf, self).__init__(**kwargs) + self.location = location + self.properties = properties + + +class Sku(msrest.serialization.Model): + """SKU for the resource. + + :param name: The SKU name. + :type name: str + :param tier: The SKU tier. + :type tier: str + :param size: The SKU size. + :type size: str + :param family: The SKU family. + :type family: str + :param model: The SKU model. + :type model: str + :param capacity: The SKU capacity. + :type capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + model: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.model = model + self.capacity = capacity + + +class StatusMessage(msrest.serialization.Model): + """Operation status message object. + + :param status: Status of the deployment operation. + :type status: str + :param error: The error reported by the operation. + :type error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + *, + status: Optional[str] = None, + error: Optional["ErrorResponse"] = None, + **kwargs + ): + super(StatusMessage, self).__init__(**kwargs) + self.status = status + self.error = error + + +class SubResource(msrest.serialization.Model): + """Sub-resource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class TagCount(msrest.serialization.Model): + """Tag count. + + :param type: Type of count. + :type type: str + :param value: Value of count. + :type value: int + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + value: Optional[int] = None, + **kwargs + ): + super(TagCount, self).__init__(**kwargs) + self.type = type + self.value = value + + +class TagDetails(msrest.serialization.Model): + """Tag details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag name ID. + :vartype id: str + :param tag_name: The tag name. + :type tag_name: str + :param count: The total number of resources that use the resource tag. When a tag is initially + created and has no associated resources, the value is 0. + :type count: ~azure.mgmt.resource.resources.v2020_06_01.models.TagCount + :param values: The list of tag values. + :type values: list[~azure.mgmt.resource.resources.v2020_06_01.models.TagValue] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + 'values': {'key': 'values', 'type': '[TagValue]'}, + } + + def __init__( + self, + *, + tag_name: Optional[str] = None, + count: Optional["TagCount"] = None, + values: Optional[List["TagValue"]] = None, + **kwargs + ): + super(TagDetails, self).__init__(**kwargs) + self.id = None + self.tag_name = tag_name + self.count = count + self.values = values + + +class Tags(msrest.serialization.Model): + """A dictionary of name and value pairs. + + :param tags: A set of tags. Dictionary of :code:``. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Tags, self).__init__(**kwargs) + self.tags = tags + + +class TagsListResult(msrest.serialization.Model): + """List of subscription tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of tags. + :type value: list[~azure.mgmt.resource.resources.v2020_06_01.models.TagDetails] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TagDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TagDetails"]] = None, + **kwargs + ): + super(TagsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TagsPatchResource(msrest.serialization.Model): + """Wrapper resource for tags patch API request only. + + :param operation: The operation type for the patch API. Possible values include: "Replace", + "Merge", "Delete". + :type operation: str or ~azure.mgmt.resource.resources.v2020_06_01.models.TagsPatchOperation + :param properties: The set of tags. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.Tags + """ + + _attribute_map = { + 'operation': {'key': 'operation', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'Tags'}, + } + + def __init__( + self, + *, + operation: Optional[Union[str, "TagsPatchOperation"]] = None, + properties: Optional["Tags"] = None, + **kwargs + ): + super(TagsPatchResource, self).__init__(**kwargs) + self.operation = operation + self.properties = properties + + +class TagsResource(msrest.serialization.Model): + """Wrapper resource for tags API requests and responses. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the tags wrapper resource. + :vartype id: str + :ivar name: The name of the tags wrapper resource. + :vartype name: str + :ivar type: The type of the tags wrapper resource. + :vartype type: str + :param properties: Required. The set of tags. + :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.Tags + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'Tags'}, + } + + def __init__( + self, + *, + properties: "Tags", + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class TagValue(msrest.serialization.Model): + """Tag information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag value ID. + :vartype id: str + :param tag_value: The tag value. + :type tag_value: str + :param count: The tag value count. + :type count: ~azure.mgmt.resource.resources.v2020_06_01.models.TagCount + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + } + + def __init__( + self, + *, + tag_value: Optional[str] = None, + count: Optional["TagCount"] = None, + **kwargs + ): + super(TagValue, self).__init__(**kwargs) + self.id = None + self.tag_value = tag_value + self.count = count + + +class TargetResource(msrest.serialization.Model): + """Target resource. + + :param id: The ID of the resource. + :type id: str + :param resource_name: The name of the resource. + :type resource_name: str + :param resource_type: The type of the resource. + :type resource_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + resource_name: Optional[str] = None, + resource_type: Optional[str] = None, + **kwargs + ): + super(TargetResource, self).__init__(**kwargs) + self.id = id + self.resource_name = resource_name + self.resource_type = resource_type + + +class TemplateHashResult(msrest.serialization.Model): + """Result of the request to calculate template hash. It contains a string of minified template and its hash. + + :param minified_template: The minified template string. + :type minified_template: str + :param template_hash: The template hash. + :type template_hash: str + """ + + _attribute_map = { + 'minified_template': {'key': 'minifiedTemplate', 'type': 'str'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + } + + def __init__( + self, + *, + minified_template: Optional[str] = None, + template_hash: Optional[str] = None, + **kwargs + ): + super(TemplateHashResult, self).__init__(**kwargs) + self.minified_template = minified_template + self.template_hash = template_hash + + +class TemplateLink(msrest.serialization.Model): + """Entity representing the reference to the template. + + :param uri: The URI of the template to deploy. Use either the uri or id property, but not both. + :type uri: str + :param id: The resource id of a Template Spec. Use either the id or uri property, but not both. + :type id: str + :param relative_path: Applicable only if this template link references a Template Spec. This + relativePath property can optionally be used to reference a Template Spec artifact by path. + :type relative_path: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: Optional[str] = None, + id: Optional[str] = None, + relative_path: Optional[str] = None, + content_version: Optional[str] = None, + **kwargs + ): + super(TemplateLink, self).__init__(**kwargs) + self.uri = uri + self.id = id + self.relative_path = relative_path + self.content_version = content_version + + +class WhatIfChange(msrest.serialization.Model): + """Information about a single resource change predicted by What-If operation. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Resource ID. + :type resource_id: str + :param change_type: Required. Type of change that will be made to the resource when the + deployment is executed. Possible values include: "Create", "Delete", "Ignore", "Deploy", + "NoChange", "Modify". + :type change_type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.ChangeType + :param before: The snapshot of the resource before the deployment is executed. + :type before: object + :param after: The predicted snapshot of the resource after the deployment is executed. + :type after: object + :param delta: The predicted changes to resource properties. + :type delta: list[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_type': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'str'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'delta': {'key': 'delta', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__( + self, + *, + resource_id: str, + change_type: Union[str, "ChangeType"], + before: Optional[object] = None, + after: Optional[object] = None, + delta: Optional[List["WhatIfPropertyChange"]] = None, + **kwargs + ): + super(WhatIfChange, self).__init__(**kwargs) + self.resource_id = resource_id + self.change_type = change_type + self.before = before + self.after = after + self.delta = delta + + +class WhatIfOperationResult(msrest.serialization.Model): + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + + :param status: Status of the What-If operation. + :type status: str + :param error: Error when What-If operation fails. + :type error: ~azure.mgmt.resource.resources.v2020_06_01.models.ErrorResponse + :param changes: List of resource changes predicted by What-If operation. + :type changes: list[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfChange] + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + 'changes': {'key': 'properties.changes', 'type': '[WhatIfChange]'}, + } + + def __init__( + self, + *, + status: Optional[str] = None, + error: Optional["ErrorResponse"] = None, + changes: Optional[List["WhatIfChange"]] = None, + **kwargs + ): + super(WhatIfOperationResult, self).__init__(**kwargs) + self.status = status + self.error = error + self.changes = changes + + +class WhatIfPropertyChange(msrest.serialization.Model): + """The predicted change to the resource property. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. The path of the property. + :type path: str + :param property_change_type: Required. The type of property change. Possible values include: + "Create", "Delete", "Modify", "Array". + :type property_change_type: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.PropertyChangeType + :param before: The value of the property before the deployment is executed. + :type before: object + :param after: The value of the property after the deployment is executed. + :type after: object + :param children: Nested property changes. + :type children: list[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'path': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'str'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'children': {'key': 'children', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__( + self, + *, + path: str, + property_change_type: Union[str, "PropertyChangeType"], + before: Optional[object] = None, + after: Optional[object] = None, + children: Optional[List["WhatIfPropertyChange"]] = None, + **kwargs + ): + super(WhatIfPropertyChange, self).__init__(**kwargs) + self.path = path + self.property_change_type = property_change_type + self.before = before + self.after = after + self.children = children diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py new file mode 100644 index 000000000000..6cfbb1bd86e3 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py @@ -0,0 +1,139 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + +class AliasPathAttributes(str, Enum): + """The attributes of the token that the alias path is referring to. + """ + + none = "None" #: The token that the alias path is referring to has no attributes. + modifiable = "Modifiable" #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + +class AliasPathTokenType(str, Enum): + """The type of the token that the alias path is referring to. + """ + + not_specified = "NotSpecified" #: The token type is not specified. + any = "Any" #: The token type can be anything. + string = "String" #: The token type is string. + object = "Object" #: The token type is object. + array = "Array" #: The token type is array. + integer = "Integer" #: The token type is integer. + number = "Number" #: The token type is number. + boolean = "Boolean" #: The token type is boolean. + +class AliasPatternType(str, Enum): + """The type of alias pattern + """ + + not_specified = "NotSpecified" #: NotSpecified is not allowed. + extract = "Extract" #: Extract is the only allowed value. + +class AliasType(str, Enum): + """The type of the alias. + """ + + not_specified = "NotSpecified" #: Alias type is unknown (same as not providing alias type). + plain_text = "PlainText" #: Alias value is not secret. + mask = "Mask" #: Alias value is secret. + +class ChangeType(str, Enum): + """Type of change that will be made to the resource when the deployment is executed. + """ + + create = "Create" #: The resource does not exist in the current state but is present in the desired state. The resource will be created when the deployment is executed. + delete = "Delete" #: The resource exists in the current state and is missing from the desired state. The resource will be deleted when the deployment is executed. + ignore = "Ignore" #: The resource exists in the current state and is missing from the desired state. The resource will not be deployed or modified when the deployment is executed. + deploy = "Deploy" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change. + no_change = "NoChange" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change. + modify = "Modify" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change. + +class DeploymentMode(str, Enum): + """The mode that is used to deploy resources. This value can be either Incremental or Complete. In + Incremental mode, resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and existing resources in + the resource group that are not included in the template are deleted. Be careful when using + Complete mode as you may unintentionally delete resources. + """ + + incremental = "Incremental" + complete = "Complete" + +class OnErrorDeploymentType(str, Enum): + """The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. + """ + + last_successful = "LastSuccessful" + specific_deployment = "SpecificDeployment" + +class PropertyChangeType(str, Enum): + """The type of property change. + """ + + create = "Create" #: The property does not exist in the current state but is present in the desired state. The property will be created when the deployment is executed. + delete = "Delete" #: The property exists in the current state and is missing from the desired state. It will be deleted when the deployment is executed. + modify = "Modify" #: The property exists in both current and desired state and is different. The value of the property will change when the deployment is executed. + array = "Array" #: The property is an array and contains nested changes. + +class ProvisioningOperation(str, Enum): + """The name of the current provisioning operation. + """ + + not_specified = "NotSpecified" #: The provisioning operation is not specified. + create = "Create" #: The provisioning operation is create. + delete = "Delete" #: The provisioning operation is delete. + waiting = "Waiting" #: The provisioning operation is waiting. + azure_async_operation_waiting = "AzureAsyncOperationWaiting" #: The provisioning operation is waiting Azure async operation. + resource_cache_waiting = "ResourceCacheWaiting" #: The provisioning operation is waiting for resource cache. + action = "Action" #: The provisioning operation is action. + read = "Read" #: The provisioning operation is read. + evaluate_deployment_output = "EvaluateDeploymentOutput" #: The provisioning operation is evaluate output. + deployment_cleanup = "DeploymentCleanup" #: The provisioning operation is cleanup. This operation is part of the 'complete' mode deployment. + +class ProvisioningState(str, Enum): + """Denotes the state of provisioning. + """ + + not_specified = "NotSpecified" + accepted = "Accepted" + running = "Running" + ready = "Ready" + creating = "Creating" + created = "Created" + deleting = "Deleting" + deleted = "Deleted" + canceled = "Canceled" + failed = "Failed" + succeeded = "Succeeded" + updating = "Updating" + +class ResourceIdentityType(str, Enum): + """The identity type. + """ + + system_assigned = "SystemAssigned" + user_assigned = "UserAssigned" + system_assigned_user_assigned = "SystemAssigned, UserAssigned" + none = "None" + +class TagsPatchOperation(str, Enum): + """The operation type for the patch API. + """ + + replace = "Replace" #: The 'replace' option replaces the entire set of existing tags with a new set. + merge = "Merge" #: The 'merge' option allows adding tags with new names and updating the values of tags with existing names. + delete = "Delete" #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + +class WhatIfResultFormat(str, Enum): + """The format of the What-If results + """ + + resource_id_only = "ResourceIdOnly" + full_resource_payloads = "FullResourcePayloads" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/__init__.py new file mode 100644 index 000000000000..a6f5fa20e792 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._deployments_operations import DeploymentsOperations +from ._providers_operations import ProvidersOperations +from ._resources_operations import ResourcesOperations +from ._resource_groups_operations import ResourceGroupsOperations +from ._tags_operations import TagsOperations +from ._deployment_operations_operations import DeploymentOperationsOperations + +__all__ = [ + 'Operations', + 'DeploymentsOperations', + 'ProvidersOperations', + 'ResourcesOperations', + 'ResourceGroupsOperations', + 'TagsOperations', + 'DeploymentOperationsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployment_operations_operations.py new file mode 100644 index 000000000000..63a053cb9939 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployment_operations_operations.py @@ -0,0 +1,709 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentOperationsOperations(object): + """DeploymentOperationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_at_scope( + self, + scope, # type: str + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentOperation" + """Gets a deployments operation. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_scope( + self, + scope, # type: str + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + def get_at_tenant_scope( + self, + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentOperation" + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_tenant_scope( + self, + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + def get_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentOperation" + """Gets a deployments operation. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + def get_at_subscription_scope( + self, + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentOperation" + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_subscription_scope( + self, + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + def get( + self, + resource_group_name, # type: str + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentOperation" + """Gets a deployments operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployments_operations.py new file mode 100644 index 000000000000..57f28212d2df --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployments_operations.py @@ -0,0 +1,3780 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations(object): + """DeploymentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_at_scope_initial( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether the deployment exists. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_at_scope_initial( + self, + scope, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update_at_scope( + self, + scope, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentExtended"] + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + """Gets a deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_at_scope_initial( + self, + scope, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate_at_scope( + self, + scope, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def export_template_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_scope( + self, + scope, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentListResult"] + """Get all the deployments at the given scope. + + :param scope: The resource scope. + :type scope: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def _delete_at_tenant_scope_initial( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_at_tenant_scope_initial( + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_at_tenant_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update_at_tenant_scope( + self, + deployment_name, # type: str + parameters, # type: "models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentExtended"] + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_at_tenant_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate_at_tenant_scope( + self, + deployment_name, # type: str + parameters, # type: "models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def _what_if_at_tenant_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if_at_tenant_scope( + self, + deployment_name, # type: str + parameters, # type: "models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._what_if_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def export_template_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_tenant_scope( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentListResult"] + """Get all the deployments at the tenant scope. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/'} # type: ignore + + def _delete_at_management_group_scope_initial( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether the deployment exists. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_at_management_group_scope_initial( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentExtended"] + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + """Gets a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_at_management_group_scope_initial( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def _what_if_at_management_group_scope_initial( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ScopedDeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._what_if_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def export_template_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_management_group_scope( + self, + group_id, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentListResult"] + """Get all the deployments for a management group. + + :param group_id: The management group ID. + :type group_id: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def _delete_at_subscription_scope_initial( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_at_subscription_scope_initial( + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_at_subscription_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update_at_subscription_scope( + self, + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentExtended"] + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_at_subscription_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate_at_subscription_scope( + self, + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def _what_if_at_subscription_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "models.DeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if_at_subscription_scope( + self, + deployment_name, # type: str + parameters, # type: "models.DeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to What If. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._what_if_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def export_template_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_subscription_scope( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentListResult"] + """Get all the deployments for a subscription. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. Deleting a template deployment does + not affect the state of the resource group. This is an asynchronous operation that returns a + status of 202 until the template deployment is successfully deleted. The Location response + header contains the URI that is used to obtain the status of the process. While the process is + running, a call to the URI in the Location header returns a status of 202. When the process + finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param resource_group_name: The name of the resource group with the deployment to delete. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether the deployment exists. + + :param resource_group_name: The name of the resource group with the deployment to check. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentExtended"] + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExtended" + """Gets a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resource group + partially deployed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.cancel.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.Deployment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def _what_if_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "models.DeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._what_if_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "models.DeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIf + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._what_if_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def export_template( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.export_template.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeploymentListResult"] + """Get all the deployments for a resource group. + + :param resource_group_name: The name of the resource group with the deployments to get. The + name is case insensitive. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def calculate_template_hash( + self, + template, # type: object + **kwargs # type: Any + ): + # type: (...) -> "models.TemplateHashResult" + """Calculate the hash of the given template. + + :param template: The template provided to calculate hash. + :type template: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateHashResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateHashResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.calculate_template_hash.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(template, 'object') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TemplateHashResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + calculate_template_hash.metadata = {'url': '/providers/Microsoft.Resources/calculateTemplateHash'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py new file mode 100644 index 000000000000..d66f094c85b4 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationListResult"] + """Lists all of the available Microsoft.Resources REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Resources/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_providers_operations.py new file mode 100644 index 000000000000..f5016b236b4b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_providers_operations.py @@ -0,0 +1,413 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ProvidersOperations(object): + """ProvidersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def unregister( + self, + resource_provider_namespace, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Provider" + """Unregisters a subscription from a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to unregister. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.unregister.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + unregister.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister'} # type: ignore + + def register( + self, + resource_provider_namespace, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Provider" + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.register.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + register.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register'} # type: ignore + + def list( + self, + top=None, # type: Optional[int] + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProviderListResult"] + """Gets all resource providers for a subscription. + + :param top: The number of results to return. If null is passed returns all deployments. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers'} # type: ignore + + def list_at_tenant_scope( + self, + top=None, # type: Optional[int] + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProviderListResult"] + """Gets all resource providers for the tenant. + + :param top: The number of results to return. If null is passed returns all providers. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers'} # type: ignore + + def get( + self, + resource_provider_namespace, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.Provider" + """Gets the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}'} # type: ignore + + def get_at_tenant_scope( + self, + resource_provider_namespace, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.Provider" + """Gets the specified resource provider at the tenant level. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/{resourceProviderNamespace}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py new file mode 100644 index 000000000000..23ddc3295b34 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py @@ -0,0 +1,572 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourceGroupsOperations(object): + """ResourceGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_existence( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether a resource group exists. + + :param resource_group_name: The name of the resource group to check. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + parameters, # type: "models.ResourceGroup" + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceGroup" + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a resource group. + + When you delete a resource group, all of its resources are also deleted. Deleting a resource + group deletes all of its template deployments and currently stored operations. + + :param resource_group_name: The name of the resource group to delete. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceGroup" + """Gets a resource group. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + parameters, # type: "models.ResourceGroupPatchable" + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceGroup" + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def _export_template_initial( + self, + resource_group_name, # type: str + parameters, # type: "models.ExportTemplateRequest" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._export_template_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ExportTemplateRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _export_template_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + def begin_export_template( + self, + resource_group_name, # type: str + parameters, # type: "models.ExportTemplateRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.ResourceGroupExportResult"] + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ExportTemplateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ResourceGroupExportResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._export_template_initial( + resource_group_name=resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceGroupListResult"] + """Gets all the resource groups for a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by + tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq + 'tag1' and tagValue eq 'Value1'. + :type filter: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resources_operations.py new file mode 100644 index 000000000000..7a8e5e0df972 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resources_operations.py @@ -0,0 +1,1462 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourcesOperations(object): + """ResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + expand=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceListResult"] + """Get all the resources for a resource group. + + :param resource_group_name: The resource group with the resources to get. + :type resource_group_name: str + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + the tags for each resource are not returned in the results.:code:`
`:code:`
`You can use + some properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resources. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources'} # type: ignore + + def _move_resources_initial( + self, + source_resource_group_name, # type: str + parameters, # type: "models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + def begin_move_resources( + self, + source_resource_group_name, # type: str + parameters, # type: "models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Moves resources from one resource group to another resource group. + + The resources to move must be in the same source resource group. The target resource group may + be in a different subscription. When moving resources, both the source group and the target + group are locked for the duration of the operation. Write and delete operations are blocked on + the groups until the move completes. + + :param source_resource_group_name: The name of the resource group containing the resources to + move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourcesMoveInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + def _validate_move_resources_initial( + self, + source_resource_group_name, # type: str + parameters, # type: "models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._validate_move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _validate_move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + def begin_validate_move_resources( + self, + source_resource_group_name, # type: str + parameters, # type: "models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to move must be in the same source resource group. The target resource group may be in a + different subscription. If validation succeeds, it returns HTTP response code 204 (no content). + If validation fails, it returns HTTP response code 409 (Conflict) with an error message. + Retrieve the URL in the Location header value to check the result of the long-running + operation. + + :param source_resource_group_name: The name of the resource group containing the resources to + validate for move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourcesMoveInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + expand=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ResourceListResult"] + """Get all the resources in a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + the tags for each resource are not returned in the results.:code:`
`:code:`
`You can use + some properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + + def check_existence( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks whether a resource exists. + + :param resource_group_name: The name of the resource group containing the resource to check. + The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The resource provider of the resource to check. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to check whether it exists. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a resource. + + :param resource_group_name: The name of the resource group that contains the resource to + delete. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to delete. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.GenericResource"] + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. + :type resource_type: str + :param resource_name: The name of the resource to create. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.GenericResource"] + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. + :type resource_type: str + :param resource_name: The name of the resource to update. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.GenericResource" + """Gets a resource. + + :param resource_group_name: The name of the resource group containing the resource to get. The + name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def check_existence_by_id( + self, + resource_id, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Checks by ID whether a resource exists. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.check_existence_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def _delete_by_id_initial( + self, + resource_id, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self._delete_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + def begin_delete_by_id( + self, + resource_id, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_by_id_initial( + resource_id=resource_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def _create_or_update_by_id_initial( + self, + resource_id, # type: str + api_version, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + def begin_create_or_update_by_id( + self, + resource_id, # type: str + api_version, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.GenericResource"] + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Create or update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def _update_by_id_initial( + self, + resource_id, # type: str + api_version, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + def begin_update_by_id( + self, + resource_id, # type: str + api_version, # type: str + parameters, # type: "models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.GenericResource"] + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def get_by_id( + self, + resource_id, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.GenericResource" + """Gets a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_id.metadata = {'url': '/{resourceId}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py new file mode 100644 index 000000000000..15e7d0e06ed1 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py @@ -0,0 +1,579 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TagsOperations(object): + """TagsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_06_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def delete_value( + self, + tag_name, # type: str + tag_value, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a predefined tag value for a predefined tag name. + + This operation allows deleting a value from the list of predefined values for an existing + predefined tag name. The value being deleted must not be in use as a tag value for the given + tag name for any resource. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to delete. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.delete_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + def create_or_update_value( + self, + tag_name, # type: str + tag_value, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TagValue" + """Creates a predefined value for a predefined tag name. + + This operation allows adding a value to the list of predefined values for an existing + predefined tag name. A tag value can have a maximum of 256 characters. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to create. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagValue, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.create_or_update_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagValue', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + def create_or_update( + self, + tag_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TagDetails" + """Creates a predefined tag name. + + This operation allows adding a name to the list of predefined tag names for the given + subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag + names cannot have the following prefixes which are reserved for Azure use: 'microsoft', + 'azure', 'windows'. + + :param tag_name: The name of the tag to create. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagDetails, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + def delete( + self, + tag_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a predefined tag name. + + This operation allows deleting a name from the list of predefined tag names for the given + subscription. The name being deleted must not be in use as a tag name for any resource. All + predefined values for the given name must have already been deleted. + + :param tag_name: The name of the tag. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TagsListResult"] + """Gets a summary of tag usage under the subscription. + + This operation performs a union of predefined tags, resource tags, resource group tags and + subscription tags, and returns a summary of usage for each tag name and value under the given + subscription. In case of a large number of tags, this operation may return a previously cached + result. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TagsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.TagsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('TagsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames'} # type: ignore + + def create_or_update_at_scope( + self, + scope, # type: str + parameters, # type: "models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> "models.TagsResource" + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. + :type scope: str + :param parameters: + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + def update_at_scope( + self, + scope, # type: str + parameters, # type: "models.TagsPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "models.TagsResource" + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. + :type scope: str + :param parameters: + :type parameters: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + def get_at_scope( + self, + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TagsResource" + """Gets the entire set of tags on a resource or subscription. + + Gets the entire set of tags on a resource or subscription. + + :param scope: The resource scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + def delete_at_scope( + self, + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the entire set of tags on a resource or subscription. + + Deletes the entire set of tags on a resource or subscription. + + :param scope: The resource scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self.delete_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/py.typed b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json index a7e8a9df7ec4..3652ff20bdb8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json @@ -34,10 +34,21 @@ "operation_groups": { "operations": "Operations", "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" + "tenants": "TenantsOperations", }, "operation_mixins": { + "check_resource_name" : { + "sync": { + "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n" + }, + "async": { + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "coroutine": true + }, + "doc": " \"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", + "call": "resource_name_definition" + } }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py index 572467e82fec..d4cbff79c14f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py @@ -21,10 +21,11 @@ from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations +from .operations import SubscriptionClientOperationsMixin from . import models -class SubscriptionClient(object): +class SubscriptionClient(SubscriptionClientOperationsMixin): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar operations: Operations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client_async.py index c78438f69703..4ad10727c363 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client_async.py @@ -19,10 +19,11 @@ from .operations_async import Operations from .operations_async import SubscriptionsOperations from .operations_async import TenantsOperations +from .operations_async import SubscriptionClientOperationsMixin from .. import models -class SubscriptionClient(object): +class SubscriptionClient(SubscriptionClientOperationsMixin): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar operations: Operations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/__init__.py index 05cc20fe3ece..3f6612d8579c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/__init__.py @@ -9,9 +9,11 @@ from ._operations_async import Operations from ._subscriptions_operations_async import SubscriptionsOperations from ._tenants_operations_async import TenantsOperations +from ._subscription_client_operations_async import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_operations_async.py index a393d74eec47..1d8d9bebea5e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2016-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscription_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscription_client_operations_async.py new file mode 100644 index 000000000000..6dfeea116982 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscription_client_operations_async.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin: + + async def check_resource_name( + self, + resource_name_definition: Optional["models.ResourceName"] = None, + **kwargs + ) -> "models.CheckResourceNameResult": + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not contains a reserved word and + does not start with a reserved word. + + :param resource_name_definition: Resource object with values for resource name and resource + type. + :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckResourceNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_resource_name.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscriptions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscriptions_operations_async.py index f70842c6f748..ba4061baf14e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscriptions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscriptions_operations_async.py @@ -64,6 +64,10 @@ def list_locations( api_version = "2016-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_locations.metadata['url'] # type: ignore @@ -75,15 +79,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -144,7 +144,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,6 +177,10 @@ def list( api_version = "2016-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +188,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_tenants_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_tenants_operations_async.py index 03ed4204182e..cab330750a5e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_tenants_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_tenants_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2016-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py index 4a05f8dc94cf..4d3bb8b7d259 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py @@ -7,22 +7,30 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import CheckResourceNameResult + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse from ._models_py3 import Location from ._models_py3 import LocationListResult from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult + from ._models_py3 import ResourceName from ._models_py3 import Subscription from ._models_py3 import SubscriptionListResult from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription from ._models_py3 import TenantListResult except (SyntaxError, ImportError): + from ._models import CheckResourceNameResult # type: ignore + from ._models import ErrorDefinition # type: ignore + from ._models import ErrorResponse # type: ignore from ._models import Location # type: ignore from ._models import LocationListResult # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore + from ._models import ResourceName # type: ignore from ._models import Subscription # type: ignore from ._models import SubscriptionListResult # type: ignore from ._models import SubscriptionPolicies # type: ignore @@ -30,21 +38,27 @@ from ._models import TenantListResult # type: ignore from ._subscription_client_enums import ( + ResourceNameStatus, SpendingLimit, SubscriptionState, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'Location', 'LocationListResult', 'Operation', 'OperationDisplay', 'OperationListResult', + 'ResourceName', 'Subscription', 'SubscriptionListResult', 'SubscriptionPolicies', 'TenantIdDescription', 'TenantListResult', + 'ResourceNameStatus', 'SpendingLimit', 'SubscriptionState', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py index e11afbf9b663..011eca63f953 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py @@ -6,9 +6,80 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from azure.core.exceptions import HttpResponseError import msrest.serialization +class CheckResourceNameResult(msrest.serialization.Model): + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + + :param name: Name of Resource. + :type name: str + :param type: Type of Resource. + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", + "Reserved". + :type status: str or ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.status = kwargs.get('status', None) + + +class ErrorDefinition(msrest.serialization.Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.code = kwargs.get('code', None) + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + class Location(msrest.serialization.Model): """Location information. @@ -156,6 +227,36 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class ResourceName(msrest.serialization.Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource. + :type name: str + :param type: Required. The type of the resource. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + class Subscription(msrest.serialization.Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py index 26c4b37031ab..b6e20cf666d5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py @@ -6,10 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import List, Optional, Union +from azure.core.exceptions import HttpResponseError import msrest.serialization +from ._subscription_client_enums import * + + +class CheckResourceNameResult(msrest.serialization.Model): + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + + :param name: Name of Resource. + :type name: str + :param type: Type of Resource. + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", + "Reserved". + :type status: str or ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + status: Optional[Union[str, "ResourceNameStatus"]] = None, + **kwargs + ): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = name + self.type = type + self.status = status + + +class ErrorDefinition(msrest.serialization.Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + code: Optional[str] = None, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = message + self.code = code + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + class Location(msrest.serialization.Model): """Location information. @@ -171,6 +253,39 @@ def __init__( self.next_link = next_link +class ResourceName(msrest.serialization.Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource. + :type name: str + :param type: Required. The type of the resource. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: str, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.name = name + self.type = type + + class Subscription(msrest.serialization.Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py index 85f50e46d3d8..cd0d7b838fe6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py @@ -8,6 +8,13 @@ from enum import Enum +class ResourceNameStatus(str, Enum): + """Is the resource name Allowed or Reserved + """ + + allowed = "Allowed" + reserved = "Reserved" + class SpendingLimit(str, Enum): """The subscription spending limit. """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py index 5ba2b6faf288..228a89205dbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py @@ -9,9 +9,11 @@ from ._operations import Operations from ._subscriptions_operations import SubscriptionsOperations from ._tenants_operations import TenantsOperations +from ._subscription_client_operations import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py index 4655364d148d..9f6a47df2ac9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2016-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..59def24d129a --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin(object): + + def check_resource_name( + self, + resource_name_definition=None, # type: Optional["models.ResourceName"] + **kwargs # type: Any + ): + # type: (...) -> "models.CheckResourceNameResult" + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not contains a reserved word and + does not start with a reserved word. + + :param resource_name_definition: Resource object with values for resource name and resource + type. + :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckResourceNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_resource_name.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscriptions_operations.py index bca60d9983bd..2b65627011d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscriptions_operations.py @@ -69,6 +69,10 @@ def list_locations( api_version = "2016-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_locations.metadata['url'] # type: ignore @@ -80,15 +84,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -150,7 +150,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,6 +184,10 @@ def list( api_version = "2016-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +195,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_tenants_operations.py index 7085c34f5ae8..d200bd4461e2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_tenants_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2016-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json index baca80a1b7b7..12ec4815857e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json @@ -34,10 +34,21 @@ "operation_groups": { "operations": "Operations", "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" + "tenants": "TenantsOperations", }, "operation_mixins": { + "check_resource_name" : { + "sync": { + "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n" + }, + "async": { + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "coroutine": true + }, + "doc": " \"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", + "call": "resource_name_definition" + } }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py index 67a56238b6fb..d46379adfdce 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py @@ -21,10 +21,11 @@ from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations +from .operations import SubscriptionClientOperationsMixin from . import models -class SubscriptionClient(object): +class SubscriptionClient(SubscriptionClientOperationsMixin): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar operations: Operations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client_async.py index 6bc878d2697c..eb935268d9ea 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client_async.py @@ -19,10 +19,11 @@ from .operations_async import Operations from .operations_async import SubscriptionsOperations from .operations_async import TenantsOperations +from .operations_async import SubscriptionClientOperationsMixin from .. import models -class SubscriptionClient(object): +class SubscriptionClient(SubscriptionClientOperationsMixin): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar operations: Operations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/__init__.py index 05cc20fe3ece..3f6612d8579c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/__init__.py @@ -9,9 +9,11 @@ from ._operations_async import Operations from ._subscriptions_operations_async import SubscriptionsOperations from ._tenants_operations_async import TenantsOperations +from ._subscription_client_operations_async import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_operations_async.py index 45806b28257b..47bdd637d3fa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscription_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscription_client_operations_async.py new file mode 100644 index 000000000000..6d418e5b7ce9 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscription_client_operations_async.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin: + + async def check_resource_name( + self, + resource_name_definition: Optional["models.ResourceName"] = None, + **kwargs + ) -> "models.CheckResourceNameResult": + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not contains a reserved word and + does not start with a reserved word. + + :param resource_name_definition: Resource object with values for resource name and resource + type. + :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckResourceNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_resource_name.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscriptions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscriptions_operations_async.py index 6caf205e93b1..a5459a23da4d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscriptions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscriptions_operations_async.py @@ -64,6 +64,10 @@ def list_locations( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_locations.metadata['url'] # type: ignore @@ -75,15 +79,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -144,7 +144,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,6 +177,10 @@ def list( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +188,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_tenants_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_tenants_operations_async.py index 8707cc35f47a..5045a6c93087 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_tenants_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_tenants_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py index 4a05f8dc94cf..4d3bb8b7d259 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py @@ -7,22 +7,30 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import CheckResourceNameResult + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse from ._models_py3 import Location from ._models_py3 import LocationListResult from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult + from ._models_py3 import ResourceName from ._models_py3 import Subscription from ._models_py3 import SubscriptionListResult from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription from ._models_py3 import TenantListResult except (SyntaxError, ImportError): + from ._models import CheckResourceNameResult # type: ignore + from ._models import ErrorDefinition # type: ignore + from ._models import ErrorResponse # type: ignore from ._models import Location # type: ignore from ._models import LocationListResult # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore + from ._models import ResourceName # type: ignore from ._models import Subscription # type: ignore from ._models import SubscriptionListResult # type: ignore from ._models import SubscriptionPolicies # type: ignore @@ -30,21 +38,27 @@ from ._models import TenantListResult # type: ignore from ._subscription_client_enums import ( + ResourceNameStatus, SpendingLimit, SubscriptionState, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'Location', 'LocationListResult', 'Operation', 'OperationDisplay', 'OperationListResult', + 'ResourceName', 'Subscription', 'SubscriptionListResult', 'SubscriptionPolicies', 'TenantIdDescription', 'TenantListResult', + 'ResourceNameStatus', 'SpendingLimit', 'SubscriptionState', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py index fc434bb268ce..e7f7b644f9b0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py @@ -6,9 +6,80 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from azure.core.exceptions import HttpResponseError import msrest.serialization +class CheckResourceNameResult(msrest.serialization.Model): + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + + :param name: Name of Resource. + :type name: str + :param type: Type of Resource. + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", + "Reserved". + :type status: str or ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.status = kwargs.get('status', None) + + +class ErrorDefinition(msrest.serialization.Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.code = kwargs.get('code', None) + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + class Location(msrest.serialization.Model): """Location information. @@ -156,6 +227,36 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class ResourceName(msrest.serialization.Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource. + :type name: str + :param type: Required. The type of the resource. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + class Subscription(msrest.serialization.Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py index 7f56bf3f2989..c0e1457f1a77 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py @@ -6,10 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import List, Optional, Union +from azure.core.exceptions import HttpResponseError import msrest.serialization +from ._subscription_client_enums import * + + +class CheckResourceNameResult(msrest.serialization.Model): + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + + :param name: Name of Resource. + :type name: str + :param type: Type of Resource. + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", + "Reserved". + :type status: str or ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + status: Optional[Union[str, "ResourceNameStatus"]] = None, + **kwargs + ): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = name + self.type = type + self.status = status + + +class ErrorDefinition(msrest.serialization.Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + code: Optional[str] = None, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = message + self.code = code + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + class Location(msrest.serialization.Model): """Location information. @@ -171,6 +253,39 @@ def __init__( self.next_link = next_link +class ResourceName(msrest.serialization.Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource. + :type name: str + :param type: Required. The type of the resource. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: str, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.name = name + self.type = type + + class Subscription(msrest.serialization.Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py index 85f50e46d3d8..cd0d7b838fe6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py @@ -8,6 +8,13 @@ from enum import Enum +class ResourceNameStatus(str, Enum): + """Is the resource name Allowed or Reserved + """ + + allowed = "Allowed" + reserved = "Reserved" + class SpendingLimit(str, Enum): """The subscription spending limit. """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py index 5ba2b6faf288..228a89205dbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py @@ -9,9 +9,11 @@ from ._operations import Operations from ._subscriptions_operations import SubscriptionsOperations from ._tenants_operations import TenantsOperations +from ._subscription_client_operations import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py index 66a11142e369..767e7c3caabd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..d5e9269d7033 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin(object): + + def check_resource_name( + self, + resource_name_definition=None, # type: Optional["models.ResourceName"] + **kwargs # type: Any + ): + # type: (...) -> "models.CheckResourceNameResult" + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not contains a reserved word and + does not start with a reserved word. + + :param resource_name_definition: Resource object with values for resource name and resource + type. + :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckResourceNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_resource_name.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscriptions_operations.py index 613daaa5d75a..ac29c78f59db 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscriptions_operations.py @@ -69,6 +69,10 @@ def list_locations( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_locations.metadata['url'] # type: ignore @@ -80,15 +84,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -150,7 +150,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,6 +184,10 @@ def list( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +195,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_tenants_operations.py index 4199425cac66..a6dff77609f9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_tenants_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2018-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json index 2677a4beed04..ce7a35e35e84 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json @@ -34,10 +34,21 @@ "operation_groups": { "operations": "Operations", "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" + "tenants": "TenantsOperations", }, "operation_mixins": { + "check_resource_name" : { + "sync": { + "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n" + }, + "async": { + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "coroutine": true + }, + "doc": " \"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", + "call": "resource_name_definition" + } }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py index a51dab34e904..474d1fc8fff5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py @@ -21,10 +21,11 @@ from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations +from .operations import SubscriptionClientOperationsMixin from . import models -class SubscriptionClient(object): +class SubscriptionClient(SubscriptionClientOperationsMixin): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar operations: Operations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client_async.py index 3fe2fdb3d5a0..077aed2178ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client_async.py @@ -19,10 +19,11 @@ from .operations_async import Operations from .operations_async import SubscriptionsOperations from .operations_async import TenantsOperations +from .operations_async import SubscriptionClientOperationsMixin from .. import models -class SubscriptionClient(object): +class SubscriptionClient(SubscriptionClientOperationsMixin): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar operations: Operations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/__init__.py index 05cc20fe3ece..3f6612d8579c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/__init__.py @@ -9,9 +9,11 @@ from ._operations_async import Operations from ._subscriptions_operations_async import SubscriptionsOperations from ._tenants_operations_async import TenantsOperations +from ._subscription_client_operations_async import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_operations_async.py index f95fe787ed5b..f5cd13f4dfda 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscription_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscription_client_operations_async.py new file mode 100644 index 000000000000..e165b2879c18 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscription_client_operations_async.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin: + + async def check_resource_name( + self, + resource_name_definition: Optional["models.ResourceName"] = None, + **kwargs + ) -> "models.CheckResourceNameResult": + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not contains a reserved word and + does not start with a reserved word. + + :param resource_name_definition: Resource object with values for resource name and resource + type. + :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckResourceNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_resource_name.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscriptions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscriptions_operations_async.py index 226bbeb6db6b..2b5825c823bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscriptions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscriptions_operations_async.py @@ -64,6 +64,10 @@ def list_locations( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_locations.metadata['url'] # type: ignore @@ -75,15 +79,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -144,7 +144,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,6 +177,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +188,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_tenants_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_tenants_operations_async.py index 303df8fd5108..04af67b045b1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_tenants_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_tenants_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py index fe0f04cc3aed..7dccb979f7cf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py @@ -7,24 +7,32 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import CheckResourceNameResult + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse from ._models_py3 import Location from ._models_py3 import LocationListResult from ._models_py3 import ManagedByTenant from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult + from ._models_py3 import ResourceName from ._models_py3 import Subscription from ._models_py3 import SubscriptionListResult from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription from ._models_py3 import TenantListResult except (SyntaxError, ImportError): + from ._models import CheckResourceNameResult # type: ignore + from ._models import ErrorDefinition # type: ignore + from ._models import ErrorResponse # type: ignore from ._models import Location # type: ignore from ._models import LocationListResult # type: ignore from ._models import ManagedByTenant # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore + from ._models import ResourceName # type: ignore from ._models import Subscription # type: ignore from ._models import SubscriptionListResult # type: ignore from ._models import SubscriptionPolicies # type: ignore @@ -32,23 +40,29 @@ from ._models import TenantListResult # type: ignore from ._subscription_client_enums import ( + ResourceNameStatus, SpendingLimit, SubscriptionState, TenantCategory, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'Location', 'LocationListResult', 'ManagedByTenant', 'Operation', 'OperationDisplay', 'OperationListResult', + 'ResourceName', 'Subscription', 'SubscriptionListResult', 'SubscriptionPolicies', 'TenantIdDescription', 'TenantListResult', + 'ResourceNameStatus', 'SpendingLimit', 'SubscriptionState', 'TenantCategory', diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py index 3a23caf3cee0..098139fbac4f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py @@ -6,9 +6,80 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from azure.core.exceptions import HttpResponseError import msrest.serialization +class CheckResourceNameResult(msrest.serialization.Model): + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + + :param name: Name of Resource. + :type name: str + :param type: Type of Resource. + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", + "Reserved". + :type status: str or ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.status = kwargs.get('status', None) + + +class ErrorDefinition(msrest.serialization.Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.code = kwargs.get('code', None) + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + class Location(msrest.serialization.Model): """Location information. @@ -181,6 +252,36 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class ResourceName(msrest.serialization.Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource. + :type name: str + :param type: Required. The type of the resource. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + class Subscription(msrest.serialization.Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py index aa8046de37fa..9187caff6e22 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py @@ -6,10 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import List, Optional, Union +from azure.core.exceptions import HttpResponseError import msrest.serialization +from ._subscription_client_enums import * + + +class CheckResourceNameResult(msrest.serialization.Model): + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + + :param name: Name of Resource. + :type name: str + :param type: Type of Resource. + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", + "Reserved". + :type status: str or ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + status: Optional[Union[str, "ResourceNameStatus"]] = None, + **kwargs + ): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = name + self.type = type + self.status = status + + +class ErrorDefinition(msrest.serialization.Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + code: Optional[str] = None, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = message + self.code = code + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + class Location(msrest.serialization.Model): """Location information. @@ -196,6 +278,39 @@ def __init__( self.next_link = next_link +class ResourceName(msrest.serialization.Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource. + :type name: str + :param type: Required. The type of the resource. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: str, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.name = name + self.type = type + + class Subscription(msrest.serialization.Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py index 0bc0d2215c9b..984662740cba 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py @@ -8,6 +8,13 @@ from enum import Enum +class ResourceNameStatus(str, Enum): + """Is the resource name Allowed or Reserved + """ + + allowed = "Allowed" + reserved = "Reserved" + class SpendingLimit(str, Enum): """The subscription spending limit. """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py index 5ba2b6faf288..228a89205dbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py @@ -9,9 +9,11 @@ from ._operations import Operations from ._subscriptions_operations import SubscriptionsOperations from ._tenants_operations import TenantsOperations +from ._subscription_client_operations import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py index 08e7274a41fc..5c1ba6e01c4c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..a880c12dceb3 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin(object): + + def check_resource_name( + self, + resource_name_definition=None, # type: Optional["models.ResourceName"] + **kwargs # type: Any + ): + # type: (...) -> "models.CheckResourceNameResult" + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not contains a reserved word and + does not start with a reserved word. + + :param resource_name_definition: Resource object with values for resource name and resource + type. + :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckResourceNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_resource_name.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscriptions_operations.py index 69285c763e68..06a97b306e54 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscriptions_operations.py @@ -69,6 +69,10 @@ def list_locations( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_locations.metadata['url'] # type: ignore @@ -80,15 +84,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -150,7 +150,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,6 +184,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +195,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_tenants_operations.py index 55877985fb6e..b9c2e8f8fb78 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_tenants_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2019-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json index 4fbc9a86fb64..56ad8e276956 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json @@ -34,10 +34,21 @@ "operation_groups": { "operations": "Operations", "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" + "tenants": "TenantsOperations", }, "operation_mixins": { + "check_resource_name" : { + "sync": { + "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n" + }, + "async": { + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "coroutine": true + }, + "doc": " \"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", + "call": "resource_name_definition" + } }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py index 779e502a5f2c..dcb7b28e5a66 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py @@ -21,10 +21,11 @@ from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations +from .operations import SubscriptionClientOperationsMixin from . import models -class SubscriptionClient(object): +class SubscriptionClient(SubscriptionClientOperationsMixin): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar operations: Operations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client_async.py index d6f7ced83db2..9a247a796d30 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client_async.py @@ -19,10 +19,11 @@ from .operations_async import Operations from .operations_async import SubscriptionsOperations from .operations_async import TenantsOperations +from .operations_async import SubscriptionClientOperationsMixin from .. import models -class SubscriptionClient(object): +class SubscriptionClient(SubscriptionClientOperationsMixin): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar operations: Operations operations diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/__init__.py index 05cc20fe3ece..3f6612d8579c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/__init__.py @@ -9,9 +9,11 @@ from ._operations_async import Operations from ._subscriptions_operations_async import SubscriptionsOperations from ._tenants_operations_async import TenantsOperations +from ._subscription_client_operations_async import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_operations_async.py index 0bf32b71355d..8a1c4bcc4348 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2019-11-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscription_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscription_client_operations_async.py new file mode 100644 index 000000000000..82c7d1f05319 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscription_client_operations_async.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin: + + async def check_resource_name( + self, + resource_name_definition: Optional["models.ResourceName"] = None, + **kwargs + ) -> "models.CheckResourceNameResult": + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not contains a reserved word and + does not start with a reserved word. + + :param resource_name_definition: Resource object with values for resource name and resource + type. + :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckResourceNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_resource_name.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscriptions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscriptions_operations_async.py index 6f6817c8fbda..b5c9c98b7efd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscriptions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscriptions_operations_async.py @@ -64,6 +64,10 @@ def list_locations( api_version = "2019-11-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_locations.metadata['url'] # type: ignore @@ -75,15 +79,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -144,7 +144,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,6 +177,10 @@ def list( api_version = "2019-11-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -185,15 +188,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_tenants_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_tenants_operations_async.py index 399f446d4345..69f9cd0a81d1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_tenants_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_tenants_operations_async.py @@ -58,6 +58,10 @@ def list( api_version = "2019-11-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +69,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py index 0880e6f4cf8f..961846b3a326 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import CheckResourceNameResult + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse from ._models_py3 import Location from ._models_py3 import LocationListResult from ._models_py3 import LocationMetadata @@ -15,12 +18,16 @@ from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult from ._models_py3 import PairedRegion + from ._models_py3 import ResourceName from ._models_py3 import Subscription from ._models_py3 import SubscriptionListResult from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription from ._models_py3 import TenantListResult except (SyntaxError, ImportError): + from ._models import CheckResourceNameResult # type: ignore + from ._models import ErrorDefinition # type: ignore + from ._models import ErrorResponse # type: ignore from ._models import Location # type: ignore from ._models import LocationListResult # type: ignore from ._models import LocationMetadata # type: ignore @@ -29,6 +36,7 @@ from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore from ._models import PairedRegion # type: ignore + from ._models import ResourceName # type: ignore from ._models import Subscription # type: ignore from ._models import SubscriptionListResult # type: ignore from ._models import SubscriptionPolicies # type: ignore @@ -38,12 +46,16 @@ from ._subscription_client_enums import ( RegionCategory, RegionType, + ResourceNameStatus, SpendingLimit, SubscriptionState, TenantCategory, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'Location', 'LocationListResult', 'LocationMetadata', @@ -52,6 +64,7 @@ 'OperationDisplay', 'OperationListResult', 'PairedRegion', + 'ResourceName', 'Subscription', 'SubscriptionListResult', 'SubscriptionPolicies', @@ -59,6 +72,7 @@ 'TenantListResult', 'RegionCategory', 'RegionType', + 'ResourceNameStatus', 'SpendingLimit', 'SubscriptionState', 'TenantCategory', diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py index b0f74f8caa5d..cd7ffe360594 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py @@ -6,9 +6,80 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from azure.core.exceptions import HttpResponseError import msrest.serialization +class CheckResourceNameResult(msrest.serialization.Model): + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + + :param name: Name of Resource. + :type name: str + :param type: Type of Resource. + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", + "Reserved". + :type status: str or ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.status = kwargs.get('status', None) + + +class ErrorDefinition(msrest.serialization.Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.code = kwargs.get('code', None) + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + class Location(msrest.serialization.Model): """Location information. @@ -272,6 +343,36 @@ def __init__( self.subscription_id = None +class ResourceName(msrest.serialization.Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource. + :type name: str + :param type: Required. The type of the resource. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + class Subscription(msrest.serialization.Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py index 6059c37ad69e..b1564c2e4008 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py @@ -6,10 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional +from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError import msrest.serialization +from ._subscription_client_enums import * + + +class CheckResourceNameResult(msrest.serialization.Model): + """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. + + :param name: Name of Resource. + :type name: str + :param type: Type of Resource. + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", + "Reserved". + :type status: str or ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + status: Optional[Union[str, "ResourceNameStatus"]] = None, + **kwargs + ): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = name + self.type = type + self.status = status + + +class ErrorDefinition(msrest.serialization.Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + code: Optional[str] = None, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = message + self.code = code + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + class Location(msrest.serialization.Model): """Location information. @@ -291,6 +373,39 @@ def __init__( self.subscription_id = None +class ResourceName(msrest.serialization.Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource. + :type name: str + :param type: Required. The type of the resource. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: str, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.name = name + self.type = type + + class Subscription(msrest.serialization.Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py index bdac328047d3..f8a54f4e71b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py @@ -22,6 +22,13 @@ class RegionType(str, Enum): physical = "Physical" logical = "Logical" +class ResourceNameStatus(str, Enum): + """Is the resource name Allowed or Reserved + """ + + allowed = "Allowed" + reserved = "Reserved" + class SpendingLimit(str, Enum): """The subscription spending limit. """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py index 5ba2b6faf288..228a89205dbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py @@ -9,9 +9,11 @@ from ._operations import Operations from ._subscriptions_operations import SubscriptionsOperations from ._tenants_operations import TenantsOperations +from ._subscription_client_operations import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py index 40d8c1c7f8a3..04751547719e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2019-11-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..201c29fb1570 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin(object): + + def check_resource_name( + self, + resource_name_definition=None, # type: Optional["models.ResourceName"] + **kwargs # type: Any + ): + # type: (...) -> "models.CheckResourceNameResult" + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not contains a reserved word and + does not start with a reserved word. + + :param resource_name_definition: Resource object with values for resource name and resource + type. + :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckResourceNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_resource_name.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscriptions_operations.py index 254764d821f0..b9a48b5abd3e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscriptions_operations.py @@ -69,6 +69,10 @@ def list_locations( api_version = "2019-11-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list_locations.metadata['url'] # type: ignore @@ -80,15 +84,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -150,7 +150,6 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,6 +184,10 @@ def list( api_version = "2019-11-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -192,15 +195,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_tenants_operations.py index c18bbd56ba36..58403dbc93f0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_tenants_operations.py @@ -63,6 +63,10 @@ def list( api_version = "2019-11-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +74,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response):