diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json index a22d7523f996..6c917a155e12 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json +++ b/sdk/servicelinker/azure-mgmt-servicelinker/_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": "0cc5e2efd6ffccf30e80d1e150b488dd87198b94", + "commit": "aafa2fdab78e3aca98d86d07d09bdef523a1de22", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/servicelinker/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/servicelinker/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/servicelinker/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py index 6da438165f25..4ba3f23a0388 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__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__ = ['ServiceLinkerManagementClient'] +__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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_metadata.json b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_metadata.json deleted file mode 100644 index 3f32c380b3c7..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_metadata.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "chosen_version": "2022-05-01", - "total_api_version_list": ["2022-05-01"], - "client": { - "name": "ServiceLinkerManagementClient", - "filename": "_service_linker_management_client", - "description": "Microsoft.ServiceLinker provider.", - "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\": [\"ServiceLinkerManagementClientConfiguration\"]}, \"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\": [\"ServiceLinkerManagementClientConfiguration\"]}, \"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 - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - } - }, - "constant": { - }, - "call": "credential", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "linker": "LinkerOperations", - "operations": "Operations" - } -} \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py index 604e2a53fb74..5c6f857bd426 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py @@ -53,8 +53,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.linker = LinkerOperations( + 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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py index 59deb8c7263b..e5754a47ce68 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py index 4f468be67bfc..834caeef5c8d 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._service_linker_management_client import ServiceLinkerManagementClient + +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__ = ['ServiceLinkerManagementClient'] +__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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py index 72d35739e43c..7a181e4ff0d9 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py @@ -53,8 +53,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.linker = LinkerOperations( + 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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py index a4070d52b65e..4c9292f73400 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py @@ -9,7 +9,12 @@ from ._linker_operations import LinkerOperations 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__ = [ 'LinkerOperations', '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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py index 7b98198c9c88..fa86846a3090 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_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,33 +27,31 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class LinkerOperations: - """LinkerOperations 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.servicelinker.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.servicelinker.aio.ServiceLinkerManagementClient`'s + :attr:`linker` 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, resource_uri: str, **kwargs: Any - ) -> AsyncIterable["_models.LinkerList"]: + ) -> AsyncIterable[_models.LinkerList]: """Returns list of Linkers which connects to the resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -63,13 +62,16 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.LinkerList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkerList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerList"] 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: @@ -77,9 +79,11 @@ def prepare_request(next_link=None): resource_uri=resource_uri, 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: @@ -87,9 +91,11 @@ def prepare_request(next_link=None): resource_uri=resource_uri, 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 @@ -129,7 +135,7 @@ async def get( resource_uri: str, linker_name: str, **kwargs: Any - ) -> "_models.LinkerResource": + ) -> _models.LinkerResource: """Returns Linker resource for a given name. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -142,13 +148,16 @@ async def get( :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] 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-05-01") # 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-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkerResource] request = build_get_request( @@ -156,11 +165,13 @@ async def get( linker_name=linker_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 @@ -186,17 +197,20 @@ async def _create_or_update_initial( self, resource_uri: str, linker_name: str, - parameters: "_models.LinkerResource", + parameters: _models.LinkerResource, **kwargs: Any - ) -> "_models.LinkerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] + ) -> _models.LinkerResource: 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-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # 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.LinkerResource] _json = self._serialize.body(parameters, 'LinkerResource') @@ -207,11 +221,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 @@ -241,9 +257,9 @@ async def begin_create_or_update( self, resource_uri: str, linker_name: str, - parameters: "_models.LinkerResource", + parameters: _models.LinkerResource, **kwargs: Any - ) -> AsyncLROPoller["_models.LinkerResource"]: + ) -> AsyncLROPoller[_models.LinkerResource]: """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -266,37 +282,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # 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.LinkerResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] 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_uri=resource_uri, linker_name=linker_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('LinkerResource', 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( @@ -315,13 +341,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements linker_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-05-01") # 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-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -329,11 +358,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements linker_name=linker_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 @@ -376,20 +407,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-05-01") # 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-05-01")) # 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_uri=resource_uri, linker_name=linker_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -399,8 +435,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( @@ -417,17 +459,20 @@ async def _update_initial( self, resource_uri: str, linker_name: str, - parameters: "_models.LinkerPatch", + parameters: _models.LinkerPatch, **kwargs: Any - ) -> "_models.LinkerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] + ) -> _models.LinkerResource: 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-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # 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.LinkerResource] _json = self._serialize.body(parameters, 'LinkerPatch') @@ -438,11 +483,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 @@ -472,9 +519,9 @@ async def begin_update( self, resource_uri: str, linker_name: str, - parameters: "_models.LinkerPatch", + parameters: _models.LinkerPatch, **kwargs: Any - ) -> AsyncLROPoller["_models.LinkerResource"]: + ) -> AsyncLROPoller[_models.LinkerResource]: """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -497,37 +544,47 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # 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.LinkerResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] 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_uri=resource_uri, linker_name=linker_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('LinkerResource', 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( @@ -545,14 +602,17 @@ async def _validate_initial( resource_uri: str, linker_name: str, **kwargs: Any - ) -> Optional["_models.ValidateOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ValidateOperationResult"]] + ) -> Optional[_models.ValidateOperationResult]: 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-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ValidateOperationResult]] request = build_validate_request_initial( @@ -560,11 +620,13 @@ async def _validate_initial( linker_name=linker_name, api_version=api_version, template_url=self._validate_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 @@ -593,7 +655,7 @@ async def begin_validate( resource_uri: str, linker_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.ValidateOperationResult"]: + ) -> AsyncLROPoller[_models.ValidateOperationResult]: """Validate a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -615,34 +677,44 @@ async def begin_validate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ValidateOperationResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._validate_initial( + raw_result = await self._validate_initial( # type: ignore resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, 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('ValidateOperationResult', 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( @@ -661,7 +733,7 @@ async def list_configurations( resource_uri: str, linker_name: str, **kwargs: Any - ) -> "_models.SourceConfigurationResult": + ) -> _models.SourceConfigurationResult: """list source configurations for a linker. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -674,13 +746,16 @@ async def list_configurations( :rtype: ~azure.mgmt.servicelinker.models.SourceConfigurationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceConfigurationResult"] 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-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceConfigurationResult] request = build_list_configurations_request( @@ -688,11 +763,13 @@ async def list_configurations( linker_name=linker_name, api_version=api_version, template_url=self.list_configurations.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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py index 3cf8e89b9021..536ce37087f4 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/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.servicelinker.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.servicelinker.aio.ServiceLinkerManagementClient`'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 the available ServiceLinker REST API operations. :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.servicelinker.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # 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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_patch.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py index 85481117b973..105ae86bd661 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py @@ -54,7 +54,9 @@ VNetSolutionType, ValidationResultStatus, ) - +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__ = [ 'AuthInfoBase', 'AzureKeyVaultProperties', @@ -101,3 +103,5 @@ 'VNetSolutionType', 'ValidationResultStatus', ] +__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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py index 24ece4530d7b..ddc39aad75f7 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, Union +from typing import List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._service_linker_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AuthInfoBase(msrest.serialization.Model): @@ -23,8 +25,8 @@ class AuthInfoBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values - include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", + :ivar auth_type: Required. The authentication type.Constant filled by server. Known values are: + "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType """ @@ -59,8 +61,8 @@ class AzureResourcePropertiesBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The azure resource type.Constant filled by server. Possible values - include: "KeyVault". + :ivar type: Required. The azure resource type.Constant filled by server. Known values are: + "KeyVault". :vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType """ @@ -91,8 +93,8 @@ class AzureKeyVaultProperties(AzureResourcePropertiesBase): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The azure resource type.Constant filled by server. Possible values - include: "KeyVault". + :ivar type: Required. The azure resource type.Constant filled by server. Known values are: + "KeyVault". :vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType :ivar connect_as_kubernetes_csi_driver: True if connect via Kubernetes CSI Driver. :vartype connect_as_kubernetes_csi_driver: bool @@ -130,8 +132,8 @@ class TargetServiceBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The target service type.Constant filled by server. Possible values - include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry". + :ivar type: Required. The target service type.Constant filled by server. Known values are: + "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType """ @@ -162,8 +164,8 @@ class AzureResource(TargetServiceBase): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The target service type.Constant filled by server. Possible values - include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry". + :ivar type: Required. The target service type.Constant filled by server. Known values are: + "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType :ivar id: The Id of azure resource. :vartype id: str @@ -185,7 +187,7 @@ def __init__( self, *, id: Optional[str] = None, - resource_properties: Optional["AzureResourcePropertiesBase"] = None, + resource_properties: Optional["_models.AzureResourcePropertiesBase"] = None, **kwargs ): """ @@ -205,8 +207,8 @@ class ConfluentBootstrapServer(TargetServiceBase): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The target service type.Constant filled by server. Possible values - include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry". + :ivar type: Required. The target service type.Constant filled by server. Known values are: + "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType :ivar endpoint: The endpoint of service. :vartype endpoint: str @@ -241,8 +243,8 @@ class ConfluentSchemaRegistry(TargetServiceBase): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The target service type.Constant filled by server. Possible values - include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry". + :ivar type: Required. The target service type.Constant filled by server. Known values are: + "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType :ivar endpoint: The endpoint of service. :vartype endpoint: str @@ -365,7 +367,7 @@ class ErrorResponse(msrest.serialization.Model): def __init__( self, *, - error: Optional["ErrorDetail"] = None, + error: Optional["_models.ErrorDetail"] = None, **kwargs ): """ @@ -384,8 +386,8 @@ class SecretInfoBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar secret_type: Required. The secret type.Constant filled by server. Possible values - include: "rawValue", "keyVaultSecretUri", "keyVaultSecretReference". + :ivar secret_type: Required. The secret type.Constant filled by server. Known values are: + "rawValue", "keyVaultSecretUri", "keyVaultSecretReference". :vartype secret_type: str or ~azure.mgmt.servicelinker.models.SecretType """ @@ -416,8 +418,8 @@ class KeyVaultSecretReferenceSecretInfo(SecretInfoBase): All required parameters must be populated in order to send to Azure. - :ivar secret_type: Required. The secret type.Constant filled by server. Possible values - include: "rawValue", "keyVaultSecretUri", "keyVaultSecretReference". + :ivar secret_type: Required. The secret type.Constant filled by server. Known values are: + "rawValue", "keyVaultSecretUri", "keyVaultSecretReference". :vartype secret_type: str or ~azure.mgmt.servicelinker.models.SecretType :ivar name: Name of the Key Vault secret. :vartype name: str @@ -459,8 +461,8 @@ class KeyVaultSecretUriSecretInfo(SecretInfoBase): All required parameters must be populated in order to send to Azure. - :ivar secret_type: Required. The secret type.Constant filled by server. Possible values - include: "rawValue", "keyVaultSecretUri", "keyVaultSecretReference". + :ivar secret_type: Required. The secret type.Constant filled by server. Known values are: + "rawValue", "keyVaultSecretUri", "keyVaultSecretReference". :vartype secret_type: str or ~azure.mgmt.servicelinker.models.SecretType :ivar value: URI to the keyvault secret. :vartype value: str @@ -508,7 +510,7 @@ def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["LinkerResource"]] = None, + value: Optional[List["_models.LinkerResource"]] = None, **kwargs ): """ @@ -531,8 +533,8 @@ class LinkerPatch(msrest.serialization.Model): :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase :ivar auth_info: The authentication type. :vartype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :ivar client_type: The application client type. Possible values include: "none", "dotnet", - "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". + :ivar client_type: The application client type. Known values are: "none", "dotnet", "java", + "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot". :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str @@ -561,11 +563,11 @@ class LinkerPatch(msrest.serialization.Model): def __init__( self, *, - target_service: Optional["TargetServiceBase"] = None, - auth_info: Optional["AuthInfoBase"] = None, - client_type: Optional[Union[str, "ClientType"]] = None, - v_net_solution: Optional["VNetSolution"] = None, - secret_store: Optional["SecretStore"] = None, + target_service: Optional["_models.TargetServiceBase"] = None, + auth_info: Optional["_models.AuthInfoBase"] = None, + client_type: Optional[Union[str, "_models.ClientType"]] = None, + v_net_solution: Optional["_models.VNetSolution"] = None, + secret_store: Optional["_models.SecretStore"] = None, scope: Optional[str] = None, **kwargs ): @@ -574,8 +576,8 @@ def __init__( :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase :keyword auth_info: The authentication type. :paramtype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :keyword client_type: The application client type. Possible values include: "none", "dotnet", - "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". + :keyword client_type: The application client type. Known values are: "none", "dotnet", "java", + "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot". :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType :keyword v_net_solution: The VNet solution. :paramtype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution @@ -688,8 +690,8 @@ class LinkerResource(ProxyResource): :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase :ivar auth_info: The authentication type. :vartype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :ivar client_type: The application client type. Possible values include: "none", "dotnet", - "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". + :ivar client_type: The application client type. Known values are: "none", "dotnet", "java", + "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot". :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str @@ -726,11 +728,11 @@ class LinkerResource(ProxyResource): def __init__( self, *, - target_service: Optional["TargetServiceBase"] = None, - auth_info: Optional["AuthInfoBase"] = None, - client_type: Optional[Union[str, "ClientType"]] = None, - v_net_solution: Optional["VNetSolution"] = None, - secret_store: Optional["SecretStore"] = None, + target_service: Optional["_models.TargetServiceBase"] = None, + auth_info: Optional["_models.AuthInfoBase"] = None, + client_type: Optional[Union[str, "_models.ClientType"]] = None, + v_net_solution: Optional["_models.VNetSolution"] = None, + secret_store: Optional["_models.SecretStore"] = None, scope: Optional[str] = None, **kwargs ): @@ -739,8 +741,8 @@ def __init__( :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase :keyword auth_info: The authentication type. :paramtype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :keyword client_type: The application client type. Possible values include: "none", "dotnet", - "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". + :keyword client_type: The application client type. Known values are: "none", "dotnet", "java", + "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot". :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType :keyword v_net_solution: The VNet solution. :paramtype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution @@ -774,11 +776,11 @@ class Operation(msrest.serialization.Model): :ivar display: Localized display information for this particular operation. :vartype display: ~azure.mgmt.servicelinker.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + "user,system". :vartype origin: str or ~azure.mgmt.servicelinker.models.Origin :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". + internal only APIs. Known values are: "Internal". :vartype action_type: str or ~azure.mgmt.servicelinker.models.ActionType """ @@ -800,7 +802,7 @@ class Operation(msrest.serialization.Model): def __init__( self, *, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, **kwargs ): """ @@ -898,8 +900,8 @@ class SecretAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values - include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", + :ivar auth_type: Required. The authentication type.Constant filled by server. Known values are: + "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar name: Username or account name for secret auth. @@ -922,7 +924,7 @@ def __init__( self, *, name: Optional[str] = None, - secret_info: Optional["SecretInfoBase"] = None, + secret_info: Optional["_models.SecretInfoBase"] = None, **kwargs ): """ @@ -967,8 +969,8 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values - include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", + :ivar auth_type: Required. The authentication type.Constant filled by server. Known values are: + "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar client_id: Required. Application clientId for servicePrincipal auth. @@ -1021,8 +1023,8 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values - include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", + :ivar auth_type: Required. The authentication type.Constant filled by server. Known values are: + "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar client_id: Required. ServicePrincipal application clientId for servicePrincipal auth. @@ -1116,7 +1118,7 @@ class SourceConfigurationResult(msrest.serialization.Model): def __init__( self, *, - configurations: Optional[List["SourceConfiguration"]] = None, + configurations: Optional[List["_models.SourceConfiguration"]] = None, **kwargs ): """ @@ -1132,8 +1134,8 @@ class SystemAssignedIdentityAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values - include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", + :ivar auth_type: Required. The authentication type.Constant filled by server. Known values are: + "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType """ @@ -1161,15 +1163,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.servicelinker.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.servicelinker.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime @@ -1188,25 +1190,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.servicelinker.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.servicelinker.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime @@ -1225,8 +1227,8 @@ class UserAssignedIdentityAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values - include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", + :ivar auth_type: Required. The authentication type.Constant filled by server. Known values are: + "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar client_id: Client Id for userAssignedIdentity. @@ -1284,7 +1286,7 @@ class ValidateOperationResult(msrest.serialization.Model): :vartype source_id: str :ivar target_id: The resource Id of target service. :vartype target_id: str - :ivar auth_type: The authentication type. Possible values include: "systemAssignedIdentity", + :ivar auth_type: The authentication type. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar validation_detail: The detail of validation result. @@ -1315,8 +1317,8 @@ def __init__( report_end_time_utc: Optional[datetime.datetime] = None, source_id: Optional[str] = None, target_id: Optional[str] = None, - auth_type: Optional[Union[str, "AuthType"]] = None, - validation_detail: Optional[List["ValidationResultItem"]] = None, + auth_type: Optional[Union[str, "_models.AuthType"]] = None, + validation_detail: Optional[List["_models.ValidationResultItem"]] = None, **kwargs ): """ @@ -1337,7 +1339,7 @@ def __init__( :paramtype source_id: str :keyword target_id: The resource Id of target service. :paramtype target_id: str - :keyword auth_type: The authentication type. Possible values include: "systemAssignedIdentity", + :keyword auth_type: The authentication type. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". :paramtype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :keyword validation_detail: The detail of validation result. @@ -1363,8 +1365,7 @@ class ValidationResultItem(msrest.serialization.Model): :vartype name: str :ivar description: The display name of validation item. :vartype description: str - :ivar result: The result of validation. Possible values include: "success", "failure", - "warning". + :ivar result: The result of validation. Known values are: "success", "failure", "warning". :vartype result: str or ~azure.mgmt.servicelinker.models.ValidationResultStatus :ivar error_message: The error message of validation result. :vartype error_message: str @@ -1385,7 +1386,7 @@ def __init__( *, name: Optional[str] = None, description: Optional[str] = None, - result: Optional[Union[str, "ValidationResultStatus"]] = None, + result: Optional[Union[str, "_models.ValidationResultStatus"]] = None, error_message: Optional[str] = None, error_code: Optional[str] = None, **kwargs @@ -1395,8 +1396,7 @@ def __init__( :paramtype name: str :keyword description: The display name of validation item. :paramtype description: str - :keyword result: The result of validation. Possible values include: "success", "failure", - "warning". + :keyword result: The result of validation. Known values are: "success", "failure", "warning". :paramtype result: str or ~azure.mgmt.servicelinker.models.ValidationResultStatus :keyword error_message: The error message of validation result. :paramtype error_message: str @@ -1416,8 +1416,8 @@ class ValueSecretInfo(SecretInfoBase): All required parameters must be populated in order to send to Azure. - :ivar secret_type: Required. The secret type.Constant filled by server. Possible values - include: "rawValue", "keyVaultSecretUri", "keyVaultSecretReference". + :ivar secret_type: Required. The secret type.Constant filled by server. Known values are: + "rawValue", "keyVaultSecretUri", "keyVaultSecretReference". :vartype secret_type: str or ~azure.mgmt.servicelinker.models.SecretType :ivar value: The actual value of the secret. :vartype value: str @@ -1450,7 +1450,7 @@ def __init__( class VNetSolution(msrest.serialization.Model): """The VNet solution for linker. - :ivar type: Type of VNet solution. Possible values include: "serviceEndpoint", "privateLink". + :ivar type: Type of VNet solution. Known values are: "serviceEndpoint", "privateLink". :vartype type: str or ~azure.mgmt.servicelinker.models.VNetSolutionType """ @@ -1461,12 +1461,11 @@ class VNetSolution(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "VNetSolutionType"]] = None, + type: Optional[Union[str, "_models.VNetSolutionType"]] = None, **kwargs ): """ - :keyword type: Type of VNet solution. Possible values include: "serviceEndpoint", - "privateLink". + :keyword type: Type of VNet solution. Known values are: "serviceEndpoint", "privateLink". :paramtype type: str or ~azure.mgmt.servicelinker.models.VNetSolutionType """ super(VNetSolution, self).__init__(**kwargs) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_patch.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py index 685a3c6e3769..e4906d01d6c9 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py @@ -7,17 +7,16 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ INTERNAL = "Internal" -class AuthType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The authentication type. """ @@ -27,13 +26,13 @@ class AuthType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SERVICE_PRINCIPAL_CERTIFICATE = "servicePrincipalCertificate" SECRET = "secret" -class AzureResourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AzureResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The azure resource type. """ KEY_VAULT = "KeyVault" -class ClientType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ClientType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The application client type """ @@ -47,8 +46,9 @@ class ClientType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DJANGO = "django" NODEJS = "nodejs" SPRING_BOOT = "springBoot" + KAFKA_SPRING_BOOT = "kafka-springBoot" -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -57,7 +57,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" """ @@ -66,7 +66,7 @@ class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM = "system" USER_SYSTEM = "user,system" -class SecretType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SecretType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The secret type. """ @@ -74,7 +74,7 @@ class SecretType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): KEY_VAULT_SECRET_URI = "keyVaultSecretUri" KEY_VAULT_SECRET_REFERENCE = "keyVaultSecretReference" -class TargetServiceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TargetServiceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The target service type. """ @@ -82,7 +82,7 @@ class TargetServiceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CONFLUENT_BOOTSTRAP_SERVER = "ConfluentBootstrapServer" CONFLUENT_SCHEMA_REGISTRY = "ConfluentSchemaRegistry" -class ValidationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ValidationResultStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The result of validation """ @@ -90,7 +90,7 @@ class ValidationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) FAILURE = "failure" WARNING = "warning" -class VNetSolutionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class VNetSolutionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of VNet solution. """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py index a4070d52b65e..4c9292f73400 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py @@ -9,7 +9,12 @@ from ._linker_operations import LinkerOperations 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__ = [ 'LinkerOperations', '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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py index 082afccf8132..6cd0c4d769a3 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_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( resource_uri: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers") 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_get_request( linker_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") path_format_arguments = { @@ -79,18 +83,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 ) @@ -99,14 +101,17 @@ def build_create_or_update_request_initial( resource_uri: str, linker_name: str, *, - json: JSONType = None, + json: Optional[_models.LinkerResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # 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", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") path_format_arguments = { @@ -117,20 +122,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 @@ -142,9 +145,12 @@ def build_delete_request_initial( linker_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") path_format_arguments = { @@ -155,18 +161,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 ) @@ -175,14 +179,17 @@ def build_update_request_initial( resource_uri: str, linker_name: str, *, - json: JSONType = None, + json: Optional[_models.LinkerPatch] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # 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", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") path_format_arguments = { @@ -193,20 +200,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 @@ -218,9 +223,12 @@ def build_validate_request_initial( linker_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker") path_format_arguments = { @@ -231,18 +239,16 @@ def build_validate_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 ) @@ -252,9 +258,12 @@ def build_list_configurations_request( linker_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -265,49 +274,45 @@ def build_list_configurations_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="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class LinkerOperations(object): - """LinkerOperations 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 LinkerOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicelinker.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.servicelinker.ServiceLinkerManagementClient`'s + :attr:`linker` 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, resource_uri: str, **kwargs: Any - ) -> Iterable["_models.LinkerList"]: + ) -> Iterable[_models.LinkerList]: """Returns list of Linkers which connects to the resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -318,13 +323,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.LinkerList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkerList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerList"] 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: @@ -332,9 +340,11 @@ def prepare_request(next_link=None): resource_uri=resource_uri, 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: @@ -342,9 +352,11 @@ def prepare_request(next_link=None): resource_uri=resource_uri, 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 @@ -384,7 +396,7 @@ def get( resource_uri: str, linker_name: str, **kwargs: Any - ) -> "_models.LinkerResource": + ) -> _models.LinkerResource: """Returns Linker resource for a given name. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -397,13 +409,16 @@ def get( :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] 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-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkerResource] request = build_get_request( @@ -411,11 +426,13 @@ def get( linker_name=linker_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 @@ -441,17 +458,20 @@ def _create_or_update_initial( self, resource_uri: str, linker_name: str, - parameters: "_models.LinkerResource", + parameters: _models.LinkerResource, **kwargs: Any - ) -> "_models.LinkerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] + ) -> _models.LinkerResource: 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-05-01") # 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-05-01")) # 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.LinkerResource] _json = self._serialize.body(parameters, 'LinkerResource') @@ -462,11 +482,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 @@ -496,9 +518,9 @@ def begin_create_or_update( self, resource_uri: str, linker_name: str, - parameters: "_models.LinkerResource", + parameters: _models.LinkerResource, **kwargs: Any - ) -> LROPoller["_models.LinkerResource"]: + ) -> LROPoller[_models.LinkerResource]: """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -521,37 +543,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # 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.LinkerResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] 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_uri=resource_uri, linker_name=linker_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('LinkerResource', 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( @@ -570,13 +602,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements linker_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-05-01") # 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-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -584,11 +619,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements linker_name=linker_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 @@ -631,20 +668,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-05-01") # 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-05-01")) # 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_uri=resource_uri, linker_name=linker_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -654,8 +696,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( @@ -672,17 +720,20 @@ def _update_initial( self, resource_uri: str, linker_name: str, - parameters: "_models.LinkerPatch", + parameters: _models.LinkerPatch, **kwargs: Any - ) -> "_models.LinkerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] + ) -> _models.LinkerResource: 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-05-01") # 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-05-01")) # 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.LinkerResource] _json = self._serialize.body(parameters, 'LinkerPatch') @@ -693,11 +744,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 @@ -727,9 +780,9 @@ def begin_update( self, resource_uri: str, linker_name: str, - parameters: "_models.LinkerPatch", + parameters: _models.LinkerPatch, **kwargs: Any - ) -> LROPoller["_models.LinkerResource"]: + ) -> LROPoller[_models.LinkerResource]: """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -752,37 +805,47 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # 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.LinkerResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] 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_uri=resource_uri, linker_name=linker_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('LinkerResource', 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( @@ -800,14 +863,17 @@ def _validate_initial( resource_uri: str, linker_name: str, **kwargs: Any - ) -> Optional["_models.ValidateOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ValidateOperationResult"]] + ) -> Optional[_models.ValidateOperationResult]: 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-05-01") # 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-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ValidateOperationResult]] request = build_validate_request_initial( @@ -815,11 +881,13 @@ def _validate_initial( linker_name=linker_name, api_version=api_version, template_url=self._validate_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 @@ -848,7 +916,7 @@ def begin_validate( resource_uri: str, linker_name: str, **kwargs: Any - ) -> LROPoller["_models.ValidateOperationResult"]: + ) -> LROPoller[_models.ValidateOperationResult]: """Validate a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -869,34 +937,44 @@ def begin_validate( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ValidateOperationResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._validate_initial( + raw_result = self._validate_initial( # type: ignore resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, 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('ValidateOperationResult', 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( @@ -915,7 +993,7 @@ def list_configurations( resource_uri: str, linker_name: str, **kwargs: Any - ) -> "_models.SourceConfigurationResult": + ) -> _models.SourceConfigurationResult: """list source configurations for a linker. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to @@ -928,13 +1006,16 @@ def list_configurations( :rtype: ~azure.mgmt.servicelinker.models.SourceConfigurationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceConfigurationResult"] 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-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceConfigurationResult] request = build_list_configurations_request( @@ -942,11 +1023,13 @@ def list_configurations( linker_name=linker_name, api_version=api_version, template_url=self.list_configurations.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 diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py index 827c3ee343c7..7f80337d598d 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/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-05-01") # 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-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceLinker/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.servicelinker.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.servicelinker.ServiceLinkerManagementClient`'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 the available ServiceLinker REST API operations. :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.servicelinker.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-01") # 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-05-01")) # 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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_patch.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/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 + """