diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json b/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json index 7cf4ecd7e565..73c8785cc5ef 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json @@ -1,11 +1,11 @@ { - "commit": "1f6e89637068d59b5ae935de9a88d5742d12f8e6", + "commit": "8aa48edd31e21dbb1bc880f640041de6548aa8ad", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.7", + "@autorest/python@6.13.16", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/deviceregistry/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/deviceregistry/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/deviceregistry/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_asset_endpoint_profiles_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_asset_endpoint_profiles_operations.py index 905d3f5691a8..25f9650670bb 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_asset_endpoint_profiles_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_asset_endpoint_profiles_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +84,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AssetEnd api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AssetEndpointProfileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +168,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AssetEndpointProfileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -242,7 +247,7 @@ async def get( :rtype: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -293,7 +298,7 @@ async def _create_or_replace_initial( resource: Union[_models.AssetEndpointProfile, IO[bytes]], **kwargs: Any ) -> _models.AssetEndpointProfile: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,10 +496,10 @@ async def _update_initial( self, resource_group_name: str, asset_endpoint_profile_name: str, - properties: Union[_models.AssetEndpointProfileUpdate, IO[bytes]], + properties: Union[_models.AssetEndpointProfile, IO[bytes]], **kwargs: Any ) -> Optional[_models.AssetEndpointProfile]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +520,7 @@ async def _update_initial( if isinstance(properties, (IOBase, bytes)): _content = properties else: - _json = self._serialize.body(properties, "AssetEndpointProfileUpdate") + _json = self._serialize.body(properties, "AssetEndpointProfile") _request = build_update_request( resource_group_name=resource_group_name, @@ -562,7 +567,7 @@ async def begin_update( self, resource_group_name: str, asset_endpoint_profile_name: str, - properties: _models.AssetEndpointProfileUpdate, + properties: _models.AssetEndpointProfile, *, content_type: str = "application/json", **kwargs: Any @@ -575,7 +580,7 @@ async def begin_update( :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. :type asset_endpoint_profile_name: str :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate + :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -620,7 +625,7 @@ async def begin_update( self, resource_group_name: str, asset_endpoint_profile_name: str, - properties: Union[_models.AssetEndpointProfileUpdate, IO[bytes]], + properties: Union[_models.AssetEndpointProfile, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.AssetEndpointProfile]: """Update a AssetEndpointProfile. @@ -630,9 +635,9 @@ async def begin_update( :type resource_group_name: str :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. :type asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Is either a - AssetEndpointProfileUpdate type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate or IO[bytes] + :param properties: The resource properties to be updated. Is either a AssetEndpointProfile type + or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile or IO[bytes] :return: An instance of AsyncLROPoller that returns either AssetEndpointProfile or the result of cls(response) :rtype: @@ -690,7 +695,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_assets_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_assets_operations.py index 63219f51f37e..067aceb7fb3a 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_assets_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_assets_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Asset"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AssetListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AssetListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -234,7 +239,7 @@ async def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.deviceregistry.models.Asset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +286,7 @@ async def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> async def _create_or_replace_initial( self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, IO[bytes]], **kwargs: Any ) -> _models.Asset: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -466,13 +471,9 @@ def get_long_running_output(pipeline_response): ) async def _update_initial( - self, - resource_group_name: str, - asset_name: str, - properties: Union[_models.AssetUpdate, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, asset_name: str, properties: Union[_models.Asset, IO[bytes]], **kwargs: Any ) -> Optional[_models.Asset]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -493,7 +494,7 @@ async def _update_initial( if isinstance(properties, (IOBase, bytes)): _content = properties else: - _json = self._serialize.body(properties, "AssetUpdate") + _json = self._serialize.body(properties, "Asset") _request = build_update_request( resource_group_name=resource_group_name, @@ -540,7 +541,7 @@ async def begin_update( self, resource_group_name: str, asset_name: str, - properties: _models.AssetUpdate, + properties: _models.Asset, *, content_type: str = "application/json", **kwargs: Any @@ -553,7 +554,7 @@ async def begin_update( :param asset_name: Asset name parameter. Required. :type asset_name: str :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate + :type properties: ~azure.mgmt.deviceregistry.models.Asset :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -591,11 +592,7 @@ async def begin_update( @distributed_trace_async async def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: Union[_models.AssetUpdate, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, asset_name: str, properties: Union[_models.Asset, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Asset]: """Update a Asset. @@ -604,9 +601,9 @@ async def begin_update( :type resource_group_name: str :param asset_name: Asset name parameter. Required. :type asset_name: str - :param properties: The resource properties to be updated. Is either a AssetUpdate type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate or IO[bytes] + :param properties: The resource properties to be updated. Is either a Asset type or a IO[bytes] + type. Required. + :type properties: ~azure.mgmt.deviceregistry.models.Asset or IO[bytes] :return: An instance of AsyncLROPoller that returns either Asset or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: @@ -662,7 +659,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, asset_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operation_status_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operation_status_operations.py index 94b988749a3c..a05847d1a788 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operation_status_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operation_status_operations.py @@ -6,7 +6,8 @@ # 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, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._operation_status_operations import build_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +67,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. :rtype: ~azure.mgmt.deviceregistry.models.OperationStatusResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py index 9fad95233545..0146f2933435 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/__init__.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/__init__.py index cdb074ea7233..91ed5923d897 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/__init__.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/__init__.py @@ -10,14 +10,10 @@ from ._models_py3 import AssetEndpointProfile from ._models_py3 import AssetEndpointProfileListResult from ._models_py3 import AssetEndpointProfileProperties -from ._models_py3 import AssetEndpointProfileUpdate -from ._models_py3 import AssetEndpointProfileUpdateProperties from ._models_py3 import AssetListResult from ._models_py3 import AssetProperties from ._models_py3 import AssetStatus from ._models_py3 import AssetStatusError -from ._models_py3 import AssetUpdate -from ._models_py3 import AssetUpdateProperties from ._models_py3 import DataPoint from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail @@ -33,13 +29,9 @@ from ._models_py3 import SystemData from ._models_py3 import TrackedResource from ._models_py3 import TransportAuthentication -from ._models_py3 import TransportAuthenticationUpdate from ._models_py3 import UserAuthentication -from ._models_py3 import UserAuthenticationUpdate from ._models_py3 import UsernamePasswordCredentials -from ._models_py3 import UsernamePasswordCredentialsUpdate from ._models_py3 import X509Credentials -from ._models_py3 import X509CredentialsUpdate from ._device_registry_mgmt_client_enums import ActionType from ._device_registry_mgmt_client_enums import CreatedByType @@ -57,14 +49,10 @@ "AssetEndpointProfile", "AssetEndpointProfileListResult", "AssetEndpointProfileProperties", - "AssetEndpointProfileUpdate", - "AssetEndpointProfileUpdateProperties", "AssetListResult", "AssetProperties", "AssetStatus", "AssetStatusError", - "AssetUpdate", - "AssetUpdateProperties", "DataPoint", "ErrorAdditionalInfo", "ErrorDetail", @@ -80,13 +68,9 @@ "SystemData", "TrackedResource", "TransportAuthentication", - "TransportAuthenticationUpdate", "UserAuthentication", - "UserAuthenticationUpdate", "UsernamePasswordCredentials", - "UsernamePasswordCredentialsUpdate", "X509Credentials", - "X509CredentialsUpdate", "ActionType", "CreatedByType", "DataPointsObservabilityMode", diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models_py3.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models_py3.py index 2edee9747b89..13bbd909042f 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models_py3.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models_py3.py @@ -365,94 +365,6 @@ def __init__( self.provisioning_state = None -class AssetEndpointProfileUpdate(_serialization.Model): - """The type used for update operations of the AssetEndpointProfile. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The updatable properties of the AssetEndpointProfile. - :vartype properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdateProperties - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "AssetEndpointProfileUpdateProperties"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.AssetEndpointProfileUpdateProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: The updatable properties of the AssetEndpointProfile. - :paramtype properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdateProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class AssetEndpointProfileUpdateProperties(_serialization.Model): - """The updatable properties of the AssetEndpointProfile. - - :ivar target_address: The local valid URI specifying the network address/DNS name of a - southbound device. The scheme part of the targetAddress URI specifies the type of the device. - The additionalConfiguration field holds further connector type specific configuration. - :vartype target_address: str - :ivar user_authentication: Defines the client authentication mechanism to the server. - :vartype user_authentication: ~azure.mgmt.deviceregistry.models.UserAuthenticationUpdate - :ivar transport_authentication: Defines the authentication mechanism for the southbound - connector connecting to the shop floor/OT device. - :vartype transport_authentication: - ~azure.mgmt.deviceregistry.models.TransportAuthenticationUpdate - :ivar additional_configuration: Contains connectivity type specific further configuration (e.g. - OPC UA, Modbus, ONVIF). - :vartype additional_configuration: str - """ - - _attribute_map = { - "target_address": {"key": "targetAddress", "type": "str"}, - "user_authentication": {"key": "userAuthentication", "type": "UserAuthenticationUpdate"}, - "transport_authentication": {"key": "transportAuthentication", "type": "TransportAuthenticationUpdate"}, - "additional_configuration": {"key": "additionalConfiguration", "type": "str"}, - } - - def __init__( - self, - *, - target_address: Optional[str] = None, - user_authentication: Optional["_models.UserAuthenticationUpdate"] = None, - transport_authentication: Optional["_models.TransportAuthenticationUpdate"] = None, - additional_configuration: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_address: The local valid URI specifying the network address/DNS name of a - southbound device. The scheme part of the targetAddress URI specifies the type of the device. - The additionalConfiguration field holds further connector type specific configuration. - :paramtype target_address: str - :keyword user_authentication: Defines the client authentication mechanism to the server. - :paramtype user_authentication: ~azure.mgmt.deviceregistry.models.UserAuthenticationUpdate - :keyword transport_authentication: Defines the authentication mechanism for the southbound - connector connecting to the shop floor/OT device. - :paramtype transport_authentication: - ~azure.mgmt.deviceregistry.models.TransportAuthenticationUpdate - :keyword additional_configuration: Contains connectivity type specific further configuration - (e.g. OPC UA, Modbus, ONVIF). - :paramtype additional_configuration: str - """ - super().__init__(**kwargs) - self.target_address = target_address - self.user_authentication = user_authentication - self.transport_authentication = transport_authentication - self.additional_configuration = additional_configuration - - class AssetListResult(_serialization.Model): """The response of a Asset list operation. @@ -749,192 +661,6 @@ def __init__(self, *, code: Optional[int] = None, message: Optional[str] = None, self.message = message -class AssetUpdate(_serialization.Model): - """The type used for update operations of the Asset. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The updatable properties of the Asset. - :vartype properties: ~azure.mgmt.deviceregistry.models.AssetUpdateProperties - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "AssetUpdateProperties"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.AssetUpdateProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: The updatable properties of the Asset. - :paramtype properties: ~azure.mgmt.deviceregistry.models.AssetUpdateProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class AssetUpdateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The updatable properties of the Asset. - - :ivar asset_type: Resource path to asset type (model) definition. - :vartype asset_type: str - :ivar enabled: Enabled/Disabled status of the asset. - :vartype enabled: bool - :ivar display_name: Human-readable display name. - :vartype display_name: str - :ivar description: Human-readable description of the asset. - :vartype description: str - :ivar manufacturer: Asset manufacturer name. - :vartype manufacturer: str - :ivar manufacturer_uri: Asset manufacturer URI. - :vartype manufacturer_uri: str - :ivar model: Asset model name. - :vartype model: str - :ivar product_code: Asset product code. - :vartype product_code: str - :ivar hardware_revision: Revision number of the hardware. - :vartype hardware_revision: str - :ivar software_revision: Revision number of the software. - :vartype software_revision: str - :ivar documentation_uri: Reference to the documentation. - :vartype documentation_uri: str - :ivar serial_number: Asset serial number. - :vartype serial_number: str - :ivar attributes: A set of key-value pairs that contain custom attributes set by the customer. - :vartype attributes: dict[str, any] - :ivar default_data_points_configuration: Protocol-specific default configuration for all data - points. Each data point can have its own configuration that overrides the default settings - here. This assumes that each asset instance has one protocol. - :vartype default_data_points_configuration: str - :ivar default_events_configuration: Protocol-specific default configuration for all events. - Each event can have its own configuration that overrides the default settings here. This - assumes that each asset instance has one protocol. - :vartype default_events_configuration: str - :ivar data_points: Array of data points that are part of the asset. Each data point can - reference an asset type capability and have per-data point configuration. See below for more - details for the definition of the dataPoints element. - :vartype data_points: list[~azure.mgmt.deviceregistry.models.DataPoint] - :ivar events: Array of events that are part of the asset. Each event can reference an asset - type capability and have per-event configuration. See below for more details about the - definition of the events element. - :vartype events: list[~azure.mgmt.deviceregistry.models.Event] - """ - - _attribute_map = { - "asset_type": {"key": "assetType", "type": "str"}, - "enabled": {"key": "enabled", "type": "bool"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "manufacturer": {"key": "manufacturer", "type": "str"}, - "manufacturer_uri": {"key": "manufacturerUri", "type": "str"}, - "model": {"key": "model", "type": "str"}, - "product_code": {"key": "productCode", "type": "str"}, - "hardware_revision": {"key": "hardwareRevision", "type": "str"}, - "software_revision": {"key": "softwareRevision", "type": "str"}, - "documentation_uri": {"key": "documentationUri", "type": "str"}, - "serial_number": {"key": "serialNumber", "type": "str"}, - "attributes": {"key": "attributes", "type": "{object}"}, - "default_data_points_configuration": {"key": "defaultDataPointsConfiguration", "type": "str"}, - "default_events_configuration": {"key": "defaultEventsConfiguration", "type": "str"}, - "data_points": {"key": "dataPoints", "type": "[DataPoint]"}, - "events": {"key": "events", "type": "[Event]"}, - } - - def __init__( - self, - *, - asset_type: Optional[str] = None, - enabled: Optional[bool] = None, - display_name: Optional[str] = None, - description: Optional[str] = None, - manufacturer: Optional[str] = None, - manufacturer_uri: Optional[str] = None, - model: Optional[str] = None, - product_code: Optional[str] = None, - hardware_revision: Optional[str] = None, - software_revision: Optional[str] = None, - documentation_uri: Optional[str] = None, - serial_number: Optional[str] = None, - attributes: Optional[Dict[str, Any]] = None, - default_data_points_configuration: Optional[str] = None, - default_events_configuration: Optional[str] = None, - data_points: Optional[List["_models.DataPoint"]] = None, - events: Optional[List["_models.Event"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword asset_type: Resource path to asset type (model) definition. - :paramtype asset_type: str - :keyword enabled: Enabled/Disabled status of the asset. - :paramtype enabled: bool - :keyword display_name: Human-readable display name. - :paramtype display_name: str - :keyword description: Human-readable description of the asset. - :paramtype description: str - :keyword manufacturer: Asset manufacturer name. - :paramtype manufacturer: str - :keyword manufacturer_uri: Asset manufacturer URI. - :paramtype manufacturer_uri: str - :keyword model: Asset model name. - :paramtype model: str - :keyword product_code: Asset product code. - :paramtype product_code: str - :keyword hardware_revision: Revision number of the hardware. - :paramtype hardware_revision: str - :keyword software_revision: Revision number of the software. - :paramtype software_revision: str - :keyword documentation_uri: Reference to the documentation. - :paramtype documentation_uri: str - :keyword serial_number: Asset serial number. - :paramtype serial_number: str - :keyword attributes: A set of key-value pairs that contain custom attributes set by the - customer. - :paramtype attributes: dict[str, any] - :keyword default_data_points_configuration: Protocol-specific default configuration for all - data points. Each data point can have its own configuration that overrides the default settings - here. This assumes that each asset instance has one protocol. - :paramtype default_data_points_configuration: str - :keyword default_events_configuration: Protocol-specific default configuration for all events. - Each event can have its own configuration that overrides the default settings here. This - assumes that each asset instance has one protocol. - :paramtype default_events_configuration: str - :keyword data_points: Array of data points that are part of the asset. Each data point can - reference an asset type capability and have per-data point configuration. See below for more - details for the definition of the dataPoints element. - :paramtype data_points: list[~azure.mgmt.deviceregistry.models.DataPoint] - :keyword events: Array of events that are part of the asset. Each event can reference an asset - type capability and have per-event configuration. See below for more details about the - definition of the events element. - :paramtype events: list[~azure.mgmt.deviceregistry.models.Event] - """ - super().__init__(**kwargs) - self.asset_type = asset_type - self.enabled = enabled - self.display_name = display_name - self.description = description - self.manufacturer = manufacturer - self.manufacturer_uri = manufacturer_uri - self.model = model - self.product_code = product_code - self.hardware_revision = hardware_revision - self.software_revision = software_revision - self.documentation_uri = documentation_uri - self.serial_number = serial_number - self.attributes = attributes - self.default_data_points_configuration = default_data_points_configuration - self.default_events_configuration = default_events_configuration - self.data_points = data_points - self.events = events - - class DataPoint(_serialization.Model): """Defines the data point properties. @@ -1535,37 +1261,13 @@ def __init__(self, *, own_certificates: List["_models.OwnCertificate"], **kwargs self.own_certificates = own_certificates -class TransportAuthenticationUpdate(_serialization.Model): - """Definition of the authentication mechanism for the southbound connector. - - :ivar own_certificates: Defines a reference to a secret which contains all certificates and - private keys that can be used by the southbound connector connecting to the shop floor/OT - device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. - :vartype own_certificates: list[~azure.mgmt.deviceregistry.models.OwnCertificate] - """ - - _attribute_map = { - "own_certificates": {"key": "ownCertificates", "type": "[OwnCertificate]"}, - } - - def __init__(self, *, own_certificates: Optional[List["_models.OwnCertificate"]] = None, **kwargs: Any) -> None: - """ - :keyword own_certificates: Defines a reference to a secret which contains all certificates and - private keys that can be used by the southbound connector connecting to the shop floor/OT - device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. - :paramtype own_certificates: list[~azure.mgmt.deviceregistry.models.OwnCertificate] - """ - super().__init__(**kwargs) - self.own_certificates = own_certificates - - class UserAuthentication(_serialization.Model): """Definition of the client authentication mechanism to the server. All required parameters must be populated in order to send to server. - :ivar mode: Defines the mode to authenticate the user of the client at the server. Required. - Known values are: "Anonymous", "Certificate", and "UsernamePassword". + :ivar mode: Defines the mode to authenticate the user of the client at the server. Known values + are: "Anonymous", "Certificate", and "UsernamePassword". :vartype mode: str or ~azure.mgmt.deviceregistry.models.UserAuthenticationMode :ivar username_password_credentials: Defines the username and password references when UsernamePassword user authentication mode is selected. @@ -1589,60 +1291,10 @@ class UserAuthentication(_serialization.Model): def __init__( self, *, - mode: Union[str, "_models.UserAuthenticationMode"], + mode: Union[str, "_models.UserAuthenticationMode"] = "Certificate", username_password_credentials: Optional["_models.UsernamePasswordCredentials"] = None, x509_credentials: Optional["_models.X509Credentials"] = None, **kwargs: Any - ) -> None: - """ - :keyword mode: Defines the mode to authenticate the user of the client at the server. Required. - Known values are: "Anonymous", "Certificate", and "UsernamePassword". - :paramtype mode: str or ~azure.mgmt.deviceregistry.models.UserAuthenticationMode - :keyword username_password_credentials: Defines the username and password references when - UsernamePassword user authentication mode is selected. - :paramtype username_password_credentials: - ~azure.mgmt.deviceregistry.models.UsernamePasswordCredentials - :keyword x509_credentials: Defines the certificate reference when Certificate user - authentication mode is selected. - :paramtype x509_credentials: ~azure.mgmt.deviceregistry.models.X509Credentials - """ - super().__init__(**kwargs) - self.mode = mode - self.username_password_credentials = username_password_credentials - self.x509_credentials = x509_credentials - - -class UserAuthenticationUpdate(_serialization.Model): - """Definition of the client authentication mechanism to the server. - - :ivar mode: Defines the mode to authenticate the user of the client at the server. Known values - are: "Anonymous", "Certificate", and "UsernamePassword". - :vartype mode: str or ~azure.mgmt.deviceregistry.models.UserAuthenticationMode - :ivar username_password_credentials: Defines the username and password references when - UsernamePassword user authentication mode is selected. - :vartype username_password_credentials: - ~azure.mgmt.deviceregistry.models.UsernamePasswordCredentialsUpdate - :ivar x509_credentials: Defines the certificate reference when Certificate user authentication - mode is selected. - :vartype x509_credentials: ~azure.mgmt.deviceregistry.models.X509CredentialsUpdate - """ - - _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "username_password_credentials": { - "key": "usernamePasswordCredentials", - "type": "UsernamePasswordCredentialsUpdate", - }, - "x509_credentials": {"key": "x509Credentials", "type": "X509CredentialsUpdate"}, - } - - def __init__( - self, - *, - mode: Optional[Union[str, "_models.UserAuthenticationMode"]] = None, - username_password_credentials: Optional["_models.UsernamePasswordCredentialsUpdate"] = None, - x509_credentials: Optional["_models.X509CredentialsUpdate"] = None, - **kwargs: Any ) -> None: """ :keyword mode: Defines the mode to authenticate the user of the client at the server. Known @@ -1651,10 +1303,10 @@ def __init__( :keyword username_password_credentials: Defines the username and password references when UsernamePassword user authentication mode is selected. :paramtype username_password_credentials: - ~azure.mgmt.deviceregistry.models.UsernamePasswordCredentialsUpdate + ~azure.mgmt.deviceregistry.models.UsernamePasswordCredentials :keyword x509_credentials: Defines the certificate reference when Certificate user authentication mode is selected. - :paramtype x509_credentials: ~azure.mgmt.deviceregistry.models.X509CredentialsUpdate + :paramtype x509_credentials: ~azure.mgmt.deviceregistry.models.X509Credentials """ super().__init__(**kwargs) self.mode = mode @@ -1695,34 +1347,6 @@ def __init__(self, *, username_reference: str, password_reference: str, **kwargs self.password_reference = password_reference -class UsernamePasswordCredentialsUpdate(_serialization.Model): - """The credentials for authentication mode UsernamePassword. - - :ivar username_reference: A reference to secret containing the username. - :vartype username_reference: str - :ivar password_reference: A reference to secret containing the password. - :vartype password_reference: str - """ - - _attribute_map = { - "username_reference": {"key": "usernameReference", "type": "str"}, - "password_reference": {"key": "passwordReference", "type": "str"}, - } - - def __init__( - self, *, username_reference: Optional[str] = None, password_reference: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword username_reference: A reference to secret containing the username. - :paramtype username_reference: str - :keyword password_reference: A reference to secret containing the password. - :paramtype password_reference: str - """ - super().__init__(**kwargs) - self.username_reference = username_reference - self.password_reference = password_reference - - class X509Credentials(_serialization.Model): """The x509 certificate for authentication mode Certificate. @@ -1749,25 +1373,3 @@ def __init__(self, *, certificate_reference: str, **kwargs: Any) -> None: """ super().__init__(**kwargs) self.certificate_reference = certificate_reference - - -class X509CredentialsUpdate(_serialization.Model): - """The x509 certificate for authentication mode Certificate. - - :ivar certificate_reference: A reference to secret containing the certificate and private key - (e.g. stored as .der/.pem or .der/.pfx). - :vartype certificate_reference: str - """ - - _attribute_map = { - "certificate_reference": {"key": "certificateReference", "type": "str"}, - } - - def __init__(self, *, certificate_reference: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword certificate_reference: A reference to secret containing the certificate and private - key (e.g. stored as .der/.pem or .der/.pfx). - :paramtype certificate_reference: str - """ - super().__init__(**kwargs) - self.certificate_reference = certificate_reference diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_asset_endpoint_profiles_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_asset_endpoint_profiles_operations.py index 9a0030040899..450387a8cb0a 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_asset_endpoint_profiles_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_asset_endpoint_profiles_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -295,7 +300,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AssetEndpoint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AssetEndpointProfileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +383,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AssetEndpointProfileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -457,7 +462,7 @@ def get( :rtype: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +513,7 @@ def _create_or_replace_initial( resource: Union[_models.AssetEndpointProfile, IO[bytes]], **kwargs: Any ) -> _models.AssetEndpointProfile: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -702,10 +707,10 @@ def _update_initial( self, resource_group_name: str, asset_endpoint_profile_name: str, - properties: Union[_models.AssetEndpointProfileUpdate, IO[bytes]], + properties: Union[_models.AssetEndpointProfile, IO[bytes]], **kwargs: Any ) -> Optional[_models.AssetEndpointProfile]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -726,7 +731,7 @@ def _update_initial( if isinstance(properties, (IOBase, bytes)): _content = properties else: - _json = self._serialize.body(properties, "AssetEndpointProfileUpdate") + _json = self._serialize.body(properties, "AssetEndpointProfile") _request = build_update_request( resource_group_name=resource_group_name, @@ -773,7 +778,7 @@ def begin_update( self, resource_group_name: str, asset_endpoint_profile_name: str, - properties: _models.AssetEndpointProfileUpdate, + properties: _models.AssetEndpointProfile, *, content_type: str = "application/json", **kwargs: Any @@ -786,7 +791,7 @@ def begin_update( :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. :type asset_endpoint_profile_name: str :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate + :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -829,7 +834,7 @@ def begin_update( self, resource_group_name: str, asset_endpoint_profile_name: str, - properties: Union[_models.AssetEndpointProfileUpdate, IO[bytes]], + properties: Union[_models.AssetEndpointProfile, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.AssetEndpointProfile]: """Update a AssetEndpointProfile. @@ -839,9 +844,9 @@ def begin_update( :type resource_group_name: str :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. :type asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Is either a - AssetEndpointProfileUpdate type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate or IO[bytes] + :param properties: The resource properties to be updated. Is either a AssetEndpointProfile type + or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile or IO[bytes] :return: An instance of LROPoller that returns either AssetEndpointProfile or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] @@ -898,7 +903,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_assets_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_assets_operations.py index 730c49337f49..c9c336f462a3 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_assets_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_assets_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -266,7 +271,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Asset"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AssetListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +351,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AssetListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +428,7 @@ def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> _mode :rtype: ~azure.mgmt.deviceregistry.models.Asset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +475,7 @@ def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> _mode def _create_or_replace_initial( self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, IO[bytes]], **kwargs: Any ) -> _models.Asset: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -654,13 +659,9 @@ def get_long_running_output(pipeline_response): ) def _update_initial( - self, - resource_group_name: str, - asset_name: str, - properties: Union[_models.AssetUpdate, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, asset_name: str, properties: Union[_models.Asset, IO[bytes]], **kwargs: Any ) -> Optional[_models.Asset]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -681,7 +682,7 @@ def _update_initial( if isinstance(properties, (IOBase, bytes)): _content = properties else: - _json = self._serialize.body(properties, "AssetUpdate") + _json = self._serialize.body(properties, "Asset") _request = build_update_request( resource_group_name=resource_group_name, @@ -728,7 +729,7 @@ def begin_update( self, resource_group_name: str, asset_name: str, - properties: _models.AssetUpdate, + properties: _models.Asset, *, content_type: str = "application/json", **kwargs: Any @@ -741,7 +742,7 @@ def begin_update( :param asset_name: Asset name parameter. Required. :type asset_name: str :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate + :type properties: ~azure.mgmt.deviceregistry.models.Asset :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -779,11 +780,7 @@ def begin_update( @distributed_trace def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: Union[_models.AssetUpdate, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, asset_name: str, properties: Union[_models.Asset, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Asset]: """Update a Asset. @@ -792,9 +789,9 @@ def begin_update( :type resource_group_name: str :param asset_name: Asset name parameter. Required. :type asset_name: str - :param properties: The resource properties to be updated. Is either a AssetUpdate type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate or IO[bytes] + :param properties: The resource properties to be updated. Is either a Asset type or a IO[bytes] + type. Required. + :type properties: ~azure.mgmt.deviceregistry.models.Asset or IO[bytes] :return: An instance of LROPoller that returns either Asset or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: @@ -850,7 +847,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, asset_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operation_status_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operation_status_operations.py index 6516f7241769..5cc8c00751e9 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operation_status_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operation_status_operations.py @@ -6,7 +6,8 @@ # 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, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +99,7 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat :rtype: ~azure.mgmt.deviceregistry.models.OperationStatusResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py index 27ad5684f4f5..8d3c24189b6f 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py index ab4cd9423ada..0013b940c766 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py @@ -35,7 +35,18 @@ def main(): response = client.assets.begin_update( resource_group_name="myResourceGroup", asset_name="my-asset", - properties={"properties": {"displayName": "NewAssetDisplayName", "enabled": False}}, + properties={ + "extendedLocation": { + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + "type": "CustomLocation", + }, + "location": "West Europe", + "properties": { + "assetEndpointProfileUri": "https://www.example.com/myAssetEndpointProfile", + "displayName": "NewAssetDisplayName", + "enabled": False, + }, + }, ).result() print(response) diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset_endpoint_profile.py index 24e6bad672be..067134264b41 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset_endpoint_profile.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset_endpoint_profile.py @@ -35,7 +35,14 @@ def main(): response = client.asset_endpoint_profiles.begin_update( resource_group_name="myResourceGroup", asset_endpoint_profile_name="my-assetendpointprofile", - properties={"properties": {"targetAddress": "https://www.example.com/myTargetAddress"}}, + properties={ + "extendedLocation": { + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + "type": "CustomLocation", + }, + "location": "West Europe", + "properties": {"targetAddress": "https://www.example.com/myTargetAddress"}, + }, ).result() print(response)