diff --git a/sdk/compute/azure-mgmt-imagebuilder/_meta.json b/sdk/compute/azure-mgmt-imagebuilder/_meta.json index 20cabf00c99c..1b5170ed2e81 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/_meta.json +++ b/sdk/compute/azure-mgmt-imagebuilder/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.13.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "725f4ca360426a32d20e81eb945065e62c285d6a", + "commit": "757cfd0f3b210a5abd7a8402527e76ff1bbeff81", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/imagebuilder/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/imagebuilder/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/imagebuilder/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/__init__.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/__init__.py index 7563ac8f4c8a..311399feaa9b 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/__init__.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ImageBuilderClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_image_builder_client.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_image_builder_client.py index e7031a37d2ad..730da69992e7 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_image_builder_client.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_image_builder_client.py @@ -58,8 +58,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.virtual_machine_image_templates = VirtualMachineImageTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_image_templates = VirtualMachineImageTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_metadata.json b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_metadata.json deleted file mode 100644 index 57435eb7e085..000000000000 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_metadata.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "chosen_version": "2022-02-14", - "total_api_version_list": ["2022-02-14"], - "client": { - "name": "ImageBuilderClient", - "filename": "_image_builder_client", - "description": "Azure Virtual Machine Image Builder Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ImageBuilderClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ImageBuilderClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "virtual_machine_image_templates": "VirtualMachineImageTemplatesOperations", - "operations": "Operations" - } -} \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_version.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_version.py index 59deb8c7263b..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_version.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/__init__.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/__init__.py index 3df2f6117e6b..3cffe2188b50 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/__init__.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._image_builder_client import ImageBuilderClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ImageBuilderClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/_image_builder_client.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/_image_builder_client.py index 47ba27df0fce..b521a687433d 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/_image_builder_client.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/_image_builder_client.py @@ -58,8 +58,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.virtual_machine_image_templates = VirtualMachineImageTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_image_templates = VirtualMachineImageTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/__init__.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/__init__.py index f2e05de690ae..4e18f9dde982 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/__init__.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/__init__.py @@ -9,7 +9,12 @@ from ._virtual_machine_image_templates_operations import VirtualMachineImageTemplatesOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VirtualMachineImageTemplatesOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_operations.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_operations.py index 83522f79109c..1e85d6f266ae 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.imagebuilder.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.imagebuilder.aio.ImageBuilderClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists available operations for the Microsoft.VirtualMachineImages provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.imagebuilder.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_patch.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_virtual_machine_image_templates_operations.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_virtual_machine_image_templates_operations.py index 78eb13320a95..71342ce20994 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_virtual_machine_image_templates_operations.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/aio/operations/_virtual_machine_image_templates_operations.py @@ -6,7 +6,7 @@ # 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, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class VirtualMachineImageTemplatesOperations: - """VirtualMachineImageTemplatesOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.imagebuilder.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.imagebuilder.aio.ImageBuilderClient`'s + :attr:`virtual_machine_image_templates` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ImageTemplateListResult"]: + ) -> AsyncIterable[_models.ImageTemplateListResult]: """Gets information about the VM image templates associated with the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,13 +60,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.imagebuilder.models.ImageTemplateListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplateListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -75,9 +77,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -85,9 +89,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -125,7 +131,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ImageTemplateListResult"]: + ) -> AsyncIterable[_models.ImageTemplateListResult]: """Gets information about the VM image templates associated with the specified resource group. :param resource_group_name: The name of the resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.imagebuilder.models.ImageTemplateListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplateListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -202,17 +215,20 @@ async def _create_or_update_initial( self, resource_group_name: str, image_template_name: str, - parameters: "_models.ImageTemplate", + parameters: _models.ImageTemplate, **kwargs: Any - ) -> "_models.ImageTemplate": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplate"] + ) -> _models.ImageTemplate: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplate] _json = self._serialize.body(parameters, 'ImageTemplate') @@ -224,11 +240,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +276,9 @@ async def begin_create_or_update( self, resource_group_name: str, image_template_name: str, - parameters: "_models.ImageTemplate", + parameters: _models.ImageTemplate, **kwargs: Any - ) -> AsyncLROPoller["_models.ImageTemplate"]: + ) -> AsyncLROPoller[_models.ImageTemplate]: """Create or update a virtual machine image template. :param resource_group_name: The name of the resource group. @@ -282,37 +300,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.imagebuilder.models.ImageTemplate] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplate] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplate"] 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( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ImageTemplate', 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': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -329,17 +357,20 @@ async def _update_initial( self, resource_group_name: str, image_template_name: str, - parameters: "_models.ImageTemplateUpdateParameters", + parameters: _models.ImageTemplateUpdateParameters, **kwargs: Any - ) -> Optional["_models.ImageTemplate"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ImageTemplate"]] + ) -> Optional[_models.ImageTemplate]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ImageTemplate]] _json = self._serialize.body(parameters, 'ImageTemplateUpdateParameters') @@ -351,11 +382,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -383,9 +416,9 @@ async def begin_update( self, resource_group_name: str, image_template_name: str, - parameters: "_models.ImageTemplateUpdateParameters", + parameters: _models.ImageTemplateUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.ImageTemplate"]: + ) -> AsyncLROPoller[_models.ImageTemplate]: """Update the tags for this Virtual Machine Image Template. :param resource_group_name: The name of the resource group. @@ -407,37 +440,47 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.imagebuilder.models.ImageTemplate] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplate] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplate"] 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ImageTemplate', 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': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -456,7 +499,7 @@ async def get( resource_group_name: str, image_template_name: str, **kwargs: Any - ) -> "_models.ImageTemplate": + ) -> _models.ImageTemplate: """Get information about a virtual machine image template. :param resource_group_name: The name of the resource group. @@ -468,13 +511,16 @@ async def get( :rtype: ~azure.mgmt.imagebuilder.models.ImageTemplate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplate] request = build_get_request( @@ -483,11 +529,13 @@ async def get( image_template_name=image_template_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -514,13 +562,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements image_template_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -529,11 +580,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements image_template_name=image_template_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,20 +628,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -598,8 +656,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -618,13 +682,16 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements image_template_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_run_request_initial( @@ -633,11 +700,13 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements image_template_name=image_template_name, api_version=api_version, template_url=self._run_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -679,20 +748,25 @@ async def begin_run( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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._run_initial( + raw_result = await self._run_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -702,8 +776,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -722,13 +802,16 @@ async def _cancel_initial( # pylint: disable=inconsistent-return-statements image_template_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_cancel_request_initial( @@ -737,11 +820,13 @@ async def _cancel_initial( # pylint: disable=inconsistent-return-statements image_template_name=image_template_name, api_version=api_version, template_url=self._cancel_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -783,20 +868,25 @@ async def begin_cancel( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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._cancel_initial( + raw_result = await self._cancel_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -806,8 +896,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -826,7 +922,7 @@ def list_run_outputs( resource_group_name: str, image_template_name: str, **kwargs: Any - ) -> AsyncIterable["_models.RunOutputCollection"]: + ) -> AsyncIterable[_models.RunOutputCollection]: """List all run outputs for the specified Image Template resource. :param resource_group_name: The name of the resource group. @@ -839,13 +935,16 @@ def list_run_outputs( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.imagebuilder.models.RunOutputCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunOutputCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunOutputCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -855,9 +954,11 @@ def prepare_request(next_link=None): image_template_name=image_template_name, api_version=api_version, template_url=self.list_run_outputs.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -867,9 +968,11 @@ def prepare_request(next_link=None): image_template_name=image_template_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -909,7 +1012,7 @@ async def get_run_output( image_template_name: str, run_output_name: str, **kwargs: Any - ) -> "_models.RunOutput": + ) -> _models.RunOutput: """Get the specified run output for the specified image template resource. :param resource_group_name: The name of the resource group. @@ -923,13 +1026,16 @@ async def get_run_output( :rtype: ~azure.mgmt.imagebuilder.models.RunOutput :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunOutput"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunOutput] request = build_get_run_output_request( @@ -939,11 +1045,13 @@ async def get_run_output( run_output_name=run_output_name, api_version=api_version, template_url=self.get_run_output.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/__init__.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/__init__.py index 31ca72bc7a71..2cd4d3192521 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/__init__.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/__init__.py @@ -55,7 +55,9 @@ RunSubState, SharedImageStorageAccountType, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'CloudErrorBody', 'ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties', @@ -103,3 +105,5 @@ 'RunSubState', 'SharedImageStorageAccountType', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_image_builder_client_enums.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_image_builder_client_enums.py index fe8f979aae5f..4ef8b329b518 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_image_builder_client_enums.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_image_builder_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -20,7 +19,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class ProvisioningErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Error code of the provisioning failure """ @@ -40,7 +39,7 @@ class ProvisioningErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SERVER_ERROR = "ServerError" OTHER = "Other" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the resource """ @@ -50,7 +49,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETING = "Deleting" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the image template. The type 'None' will remove any identities from the image template. """ @@ -58,7 +57,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" NONE = "None" -class RunState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RunState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of the last run """ @@ -69,7 +68,7 @@ class RunState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class RunSubState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RunSubState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sub-state of the last run """ @@ -79,7 +78,7 @@ class RunSubState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALIDATING = "Validating" DISTRIBUTING = "Distributing" -class SharedImageStorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SharedImageStorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS). """ diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_models_py3.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_models_py3.py index 07d6c2132ab5..cf605b7f597c 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._image_builder_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class CloudErrorBody(msrest.serialization.Model): @@ -43,7 +45,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -236,8 +238,8 @@ class ImageTemplate(TrackedResource): :vartype validate: ~azure.mgmt.imagebuilder.models.ImageTemplatePropertiesValidate :ivar distribute: The distribution targets where the image output needs to go to. :vartype distribute: list[~azure.mgmt.imagebuilder.models.ImageTemplateDistributor] - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.imagebuilder.models.ProvisioningState :ivar provisioning_error: Provisioning error, if any. :vartype provisioning_error: ~azure.mgmt.imagebuilder.models.ProvisioningError @@ -304,14 +306,14 @@ def __init__( self, *, location: str, - identity: "ImageTemplateIdentity", + identity: "_models.ImageTemplateIdentity", tags: Optional[Dict[str, str]] = None, - source: Optional["ImageTemplateSource"] = None, - customize: Optional[List["ImageTemplateCustomizer"]] = None, - validate: Optional["ImageTemplatePropertiesValidate"] = None, - distribute: Optional[List["ImageTemplateDistributor"]] = None, + source: Optional["_models.ImageTemplateSource"] = None, + customize: Optional[List["_models.ImageTemplateCustomizer"]] = None, + validate: Optional["_models.ImageTemplatePropertiesValidate"] = None, + distribute: Optional[List["_models.ImageTemplateDistributor"]] = None, build_timeout_in_minutes: Optional[int] = 0, - vm_profile: Optional["ImageTemplateVmProfile"] = None, + vm_profile: Optional["_models.ImageTemplateVmProfile"] = None, staging_resource_group: Optional[str] = None, **kwargs ): @@ -522,7 +524,7 @@ class ImageTemplateIdentity(msrest.serialization.Model): """Identity for the image template. :ivar type: The type of identity used for the image template. The type 'None' will remove any - identities from the image template. Possible values include: "UserAssigned", "None". + identities from the image template. Known values are: "UserAssigned", "None". :vartype type: str or ~azure.mgmt.imagebuilder.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: @@ -539,13 +541,13 @@ class ImageTemplateIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, **kwargs ): """ :keyword type: The type of identity used for the image template. The type 'None' will remove - any identities from the image template. Possible values include: "UserAssigned", "None". + any identities from the image template. Known values are: "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.imagebuilder.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: @@ -608,10 +610,10 @@ class ImageTemplateLastRunStatus(msrest.serialization.Model): :vartype start_time: ~datetime.datetime :ivar end_time: End time of the last run (UTC). :vartype end_time: ~datetime.datetime - :ivar run_state: State of the last run. Possible values include: "Running", "Canceling", - "Succeeded", "PartiallySucceeded", "Failed", "Canceled". + :ivar run_state: State of the last run. Known values are: "Running", "Canceling", "Succeeded", + "PartiallySucceeded", "Failed", "Canceled". :vartype run_state: str or ~azure.mgmt.imagebuilder.models.RunState - :ivar run_sub_state: Sub-state of the last run. Possible values include: "Queued", "Building", + :ivar run_sub_state: Sub-state of the last run. Known values are: "Queued", "Building", "Customizing", "Validating", "Distributing". :vartype run_sub_state: str or ~azure.mgmt.imagebuilder.models.RunSubState :ivar message: Verbose information about the last run state. @@ -631,8 +633,8 @@ def __init__( *, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, - run_state: Optional[Union[str, "RunState"]] = None, - run_sub_state: Optional[Union[str, "RunSubState"]] = None, + run_state: Optional[Union[str, "_models.RunState"]] = None, + run_sub_state: Optional[Union[str, "_models.RunSubState"]] = None, message: Optional[str] = None, **kwargs ): @@ -641,11 +643,11 @@ def __init__( :paramtype start_time: ~datetime.datetime :keyword end_time: End time of the last run (UTC). :paramtype end_time: ~datetime.datetime - :keyword run_state: State of the last run. Possible values include: "Running", "Canceling", + :keyword run_state: State of the last run. Known values are: "Running", "Canceling", "Succeeded", "PartiallySucceeded", "Failed", "Canceled". :paramtype run_state: str or ~azure.mgmt.imagebuilder.models.RunState - :keyword run_sub_state: Sub-state of the last run. Possible values include: "Queued", - "Building", "Customizing", "Validating", "Distributing". + :keyword run_sub_state: Sub-state of the last run. Known values are: "Queued", "Building", + "Customizing", "Validating", "Distributing". :paramtype run_sub_state: str or ~azure.mgmt.imagebuilder.models.RunSubState :keyword message: Verbose information about the last run state. :paramtype message: str @@ -675,7 +677,7 @@ class ImageTemplateListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ImageTemplate"]] = None, + value: Optional[List["_models.ImageTemplate"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -876,7 +878,7 @@ def __init__( offer: Optional[str] = None, sku: Optional[str] = None, version: Optional[str] = None, - plan_info: Optional["PlatformImagePurchasePlan"] = None, + plan_info: Optional["_models.PlatformImagePurchasePlan"] = None, **kwargs ): """ @@ -1106,7 +1108,7 @@ def __init__( *, continue_distribute_on_failure: Optional[bool] = False, source_validation_only: Optional[bool] = False, - in_vm_validations: Optional[List["ImageTemplateInVMValidator"]] = None, + in_vm_validations: Optional[List["_models.ImageTemplateInVMValidator"]] = None, **kwargs ): """ @@ -1210,7 +1212,7 @@ class ImageTemplateSharedImageDistributor(ImageTemplateDistributor): from latest. Omit to use the default (false). :vartype exclude_from_latest: bool :ivar storage_account_type: Storage account type to be used to store the shared image. Omit to - use the default (Standard_LRS). Possible values include: "Standard_LRS", "Standard_ZRS". + use the default (Standard_LRS). Known values are: "Standard_LRS", "Standard_ZRS". :vartype storage_account_type: str or ~azure.mgmt.imagebuilder.models.SharedImageStorageAccountType """ @@ -1240,7 +1242,7 @@ def __init__( replication_regions: List[str], artifact_tags: Optional[Dict[str, str]] = None, exclude_from_latest: Optional[bool] = False, - storage_account_type: Optional[Union[str, "SharedImageStorageAccountType"]] = None, + storage_account_type: Optional[Union[str, "_models.SharedImageStorageAccountType"]] = None, **kwargs ): """ @@ -1257,7 +1259,7 @@ def __init__( excluded from latest. Omit to use the default (false). :paramtype exclude_from_latest: bool :keyword storage_account_type: Storage account type to be used to store the shared image. Omit - to use the default (Standard_LRS). Possible values include: "Standard_LRS", "Standard_ZRS". + to use the default (Standard_LRS). Known values are: "Standard_LRS", "Standard_ZRS". :paramtype storage_account_type: str or ~azure.mgmt.imagebuilder.models.SharedImageStorageAccountType """ @@ -1441,7 +1443,7 @@ class ImageTemplateUpdateParameters(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ImageTemplateIdentity"] = None, + identity: Optional["_models.ImageTemplateIdentity"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1535,7 +1537,7 @@ def __init__( vm_size: Optional[str] = "", os_disk_size_gb: Optional[int] = 0, user_assigned_identities: Optional[List[str]] = None, - vnet_config: Optional["VirtualNetworkConfig"] = None, + vnet_config: Optional["_models.VirtualNetworkConfig"] = None, **kwargs ): """ @@ -1653,7 +1655,7 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, properties: Optional[Any] = None, is_data_action: Optional[bool] = None, @@ -1742,7 +1744,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1807,7 +1809,7 @@ def __init__( class ProvisioningError(msrest.serialization.Model): """Describes the error happened when create or update an image template. - :ivar provisioning_error_code: Error code of the provisioning failure. Possible values include: + :ivar provisioning_error_code: Error code of the provisioning failure. Known values are: "BadSourceType", "BadPIRSource", "BadManagedImageSource", "BadSharedImageVersionSource", "BadCustomizerType", "UnsupportedCustomizerType", "NoCustomizerScript", "BadValidatorType", "UnsupportedValidatorType", "NoValidatorScript", "BadDistributeType", @@ -1825,17 +1827,16 @@ class ProvisioningError(msrest.serialization.Model): def __init__( self, *, - provisioning_error_code: Optional[Union[str, "ProvisioningErrorCode"]] = None, + provisioning_error_code: Optional[Union[str, "_models.ProvisioningErrorCode"]] = None, message: Optional[str] = None, **kwargs ): """ - :keyword provisioning_error_code: Error code of the provisioning failure. Possible values - include: "BadSourceType", "BadPIRSource", "BadManagedImageSource", - "BadSharedImageVersionSource", "BadCustomizerType", "UnsupportedCustomizerType", - "NoCustomizerScript", "BadValidatorType", "UnsupportedValidatorType", "NoValidatorScript", - "BadDistributeType", "BadSharedImageDistribute", "BadStagingResourceGroup", "ServerError", - "Other". + :keyword provisioning_error_code: Error code of the provisioning failure. Known values are: + "BadSourceType", "BadPIRSource", "BadManagedImageSource", "BadSharedImageVersionSource", + "BadCustomizerType", "UnsupportedCustomizerType", "NoCustomizerScript", "BadValidatorType", + "UnsupportedValidatorType", "NoValidatorScript", "BadDistributeType", + "BadSharedImageDistribute", "BadStagingResourceGroup", "ServerError", "Other". :paramtype provisioning_error_code: str or ~azure.mgmt.imagebuilder.models.ProvisioningErrorCode :keyword message: Verbose error message about the provisioning failure. @@ -1907,8 +1908,8 @@ class RunOutput(ProxyResource): :vartype artifact_id: str :ivar artifact_uri: The location URI of the artifact. :vartype artifact_uri: str - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.imagebuilder.models.ProvisioningState """ @@ -1966,7 +1967,7 @@ class RunOutputCollection(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["RunOutput"]] = None, + value: Optional[List["_models.RunOutput"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1986,15 +1987,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.imagebuilder.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.imagebuilder.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime @@ -2013,25 +2014,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.imagebuilder.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.imagebuilder.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_patch.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/__init__.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/__init__.py index f2e05de690ae..4e18f9dde982 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/__init__.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/__init__.py @@ -9,7 +9,12 @@ from ._virtual_machine_image_templates_operations import VirtualMachineImageTemplatesOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VirtualMachineImageTemplatesOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_operations.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_operations.py index acf5b9ffc618..a3ebb3cbc459 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_operations.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.VirtualMachineImages/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -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. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.imagebuilder.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.imagebuilder.ImageBuilderClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists available operations for the Microsoft.VirtualMachineImages provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -85,31 +85,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.imagebuilder.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_patch.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_virtual_machine_image_templates_operations.py b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_virtual_machine_image_templates_operations.py index 107f8b834cbe..00789ec27eb5 100644 --- a/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_virtual_machine_image_templates_operations.py +++ b/sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/operations/_virtual_machine_image_templates_operations.py @@ -6,7 +6,7 @@ # 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, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.VirtualMachineImages/imageTemplates") # pylint: disable=line-too-long path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -100,14 +102,17 @@ def build_create_or_update_request_initial( resource_group_name: str, image_template_name: str, *, - json: JSONType = None, + json: Optional[_models.ImageTemplate] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") # pylint: disable=line-too-long path_format_arguments = { @@ -119,20 +124,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -144,14 +147,17 @@ def build_update_request_initial( resource_group_name: str, image_template_name: str, *, - json: JSONType = None, + json: Optional[_models.ImageTemplateUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") # pylint: disable=line-too-long path_format_arguments = { @@ -163,20 +169,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -189,9 +193,12 @@ def build_get_request( image_template_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") # pylint: disable=line-too-long path_format_arguments = { @@ -203,18 +210,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -225,9 +230,12 @@ def build_delete_request_initial( image_template_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") # pylint: disable=line-too-long path_format_arguments = { @@ -239,18 +247,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -261,9 +267,12 @@ def build_run_request_initial( image_template_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run") # pylint: disable=line-too-long path_format_arguments = { @@ -275,18 +284,16 @@ def build_run_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -297,9 +304,12 @@ def build_cancel_request_initial( image_template_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/cancel") # pylint: disable=line-too-long path_format_arguments = { @@ -311,18 +321,16 @@ def build_cancel_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -333,9 +341,12 @@ def build_list_run_outputs_request( image_template_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs") # pylint: disable=line-too-long path_format_arguments = { @@ -347,18 +358,16 @@ def build_list_run_outputs_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -370,9 +379,12 @@ def build_get_run_output_request( run_output_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}") # pylint: disable=line-too-long path_format_arguments = { @@ -385,48 +397,44 @@ def build_get_run_output_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class VirtualMachineImageTemplatesOperations(object): - """VirtualMachineImageTemplatesOperations 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. +class VirtualMachineImageTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.imagebuilder.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.imagebuilder.ImageBuilderClient`'s + :attr:`virtual_machine_image_templates` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ImageTemplateListResult"]: + ) -> Iterable[_models.ImageTemplateListResult]: """Gets information about the VM image templates associated with the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -435,13 +443,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.imagebuilder.models.ImageTemplateListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplateListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -449,9 +460,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -459,9 +472,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -499,7 +514,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ImageTemplateListResult"]: + ) -> Iterable[_models.ImageTemplateListResult]: """Gets information about the VM image templates associated with the specified resource group. :param resource_group_name: The name of the resource group. @@ -510,13 +525,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.imagebuilder.models.ImageTemplateListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplateListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplateListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -525,9 +543,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -536,9 +556,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -575,17 +597,20 @@ def _create_or_update_initial( self, resource_group_name: str, image_template_name: str, - parameters: "_models.ImageTemplate", + parameters: _models.ImageTemplate, **kwargs: Any - ) -> "_models.ImageTemplate": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplate"] + ) -> _models.ImageTemplate: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplate] _json = self._serialize.body(parameters, 'ImageTemplate') @@ -597,11 +622,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -631,9 +658,9 @@ def begin_create_or_update( self, resource_group_name: str, image_template_name: str, - parameters: "_models.ImageTemplate", + parameters: _models.ImageTemplate, **kwargs: Any - ) -> LROPoller["_models.ImageTemplate"]: + ) -> LROPoller[_models.ImageTemplate]: """Create or update a virtual machine image template. :param resource_group_name: The name of the resource group. @@ -655,37 +682,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.imagebuilder.models.ImageTemplate] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplate] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplate"] 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( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ImageTemplate', 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': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -702,17 +739,20 @@ def _update_initial( self, resource_group_name: str, image_template_name: str, - parameters: "_models.ImageTemplateUpdateParameters", + parameters: _models.ImageTemplateUpdateParameters, **kwargs: Any - ) -> Optional["_models.ImageTemplate"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ImageTemplate"]] + ) -> Optional[_models.ImageTemplate]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ImageTemplate]] _json = self._serialize.body(parameters, 'ImageTemplateUpdateParameters') @@ -724,11 +764,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -756,9 +798,9 @@ def begin_update( self, resource_group_name: str, image_template_name: str, - parameters: "_models.ImageTemplateUpdateParameters", + parameters: _models.ImageTemplateUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.ImageTemplate"]: + ) -> LROPoller[_models.ImageTemplate]: """Update the tags for this Virtual Machine Image Template. :param resource_group_name: The name of the resource group. @@ -780,37 +822,47 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.imagebuilder.models.ImageTemplate] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplate] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplate"] 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ImageTemplate', 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': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -829,7 +881,7 @@ def get( resource_group_name: str, image_template_name: str, **kwargs: Any - ) -> "_models.ImageTemplate": + ) -> _models.ImageTemplate: """Get information about a virtual machine image template. :param resource_group_name: The name of the resource group. @@ -841,13 +893,16 @@ def get( :rtype: ~azure.mgmt.imagebuilder.models.ImageTemplate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageTemplate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ImageTemplate] request = build_get_request( @@ -856,11 +911,13 @@ def get( image_template_name=image_template_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -887,13 +944,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements image_template_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -902,11 +962,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements image_template_name=image_template_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -948,20 +1010,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -971,8 +1038,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -991,13 +1064,16 @@ def _run_initial( # pylint: disable=inconsistent-return-statements image_template_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_run_request_initial( @@ -1006,11 +1082,13 @@ def _run_initial( # pylint: disable=inconsistent-return-statements image_template_name=image_template_name, api_version=api_version, template_url=self._run_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1052,20 +1130,25 @@ def begin_run( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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._run_initial( + raw_result = self._run_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1075,8 +1158,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1095,13 +1184,16 @@ def _cancel_initial( # pylint: disable=inconsistent-return-statements image_template_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_cancel_request_initial( @@ -1110,11 +1202,13 @@ def _cancel_initial( # pylint: disable=inconsistent-return-statements image_template_name=image_template_name, api_version=api_version, template_url=self._cancel_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1156,20 +1250,25 @@ def begin_cancel( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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._cancel_initial( + raw_result = self._cancel_initial( # type: ignore resource_group_name=resource_group_name, image_template_name=image_template_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1179,8 +1278,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1199,7 +1304,7 @@ def list_run_outputs( resource_group_name: str, image_template_name: str, **kwargs: Any - ) -> Iterable["_models.RunOutputCollection"]: + ) -> Iterable[_models.RunOutputCollection]: """List all run outputs for the specified Image Template resource. :param resource_group_name: The name of the resource group. @@ -1211,13 +1316,16 @@ def list_run_outputs( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.imagebuilder.models.RunOutputCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunOutputCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunOutputCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1227,9 +1335,11 @@ def prepare_request(next_link=None): image_template_name=image_template_name, api_version=api_version, template_url=self.list_run_outputs.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1239,9 +1349,11 @@ def prepare_request(next_link=None): image_template_name=image_template_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1281,7 +1393,7 @@ def get_run_output( image_template_name: str, run_output_name: str, **kwargs: Any - ) -> "_models.RunOutput": + ) -> _models.RunOutput: """Get the specified run output for the specified image template resource. :param resource_group_name: The name of the resource group. @@ -1295,13 +1407,16 @@ def get_run_output( :rtype: ~azure.mgmt.imagebuilder.models.RunOutput :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunOutput"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunOutput] request = build_get_run_output_request( @@ -1311,11 +1426,13 @@ def get_run_output( run_output_name=run_output_name, api_version=api_version, template_url=self.get_run_output.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs