diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json b/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json index 9b170df8c803..9fe820a9fb86 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json @@ -1,6 +1,6 @@ { - "commit": "6132d27fe22b7876e0064827a5ac70f7a6166ab9", + "commit": "fc65cf29fa9f13821e6cc0cf089b7e67663d9d2e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/deviceregistry/DeviceRegistry.Management", - "@azure-tools/typespec-python": "0.36.5" + "@azure-tools/typespec-python": "0.38.4" } \ No newline at end of file diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json b/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json new file mode 100644 index 000000000000..d31b729cafd3 --- /dev/null +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json @@ -0,0 +1,66 @@ +{ + "CrossLanguagePackageId": "Microsoft.DeviceRegistry", + "CrossLanguageDefinitionId": { + "azure.mgmt.deviceregistry.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.deviceregistry.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.deviceregistry.models.Asset": "Microsoft.DeviceRegistry.Asset", + "azure.mgmt.deviceregistry.models.AssetEndpointProfile": "Microsoft.DeviceRegistry.AssetEndpointProfile", + "azure.mgmt.deviceregistry.models.AssetEndpointProfileProperties": "Microsoft.DeviceRegistry.AssetEndpointProfileProperties", + "azure.mgmt.deviceregistry.models.AssetEndpointProfileStatus": "Microsoft.DeviceRegistry.AssetEndpointProfileStatus", + "azure.mgmt.deviceregistry.models.AssetEndpointProfileStatusError": "Microsoft.DeviceRegistry.AssetEndpointProfileStatusError", + "azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.deviceregistry.models.AssetProperties": "Microsoft.DeviceRegistry.AssetProperties", + "azure.mgmt.deviceregistry.models.AssetStatus": "Microsoft.DeviceRegistry.AssetStatus", + "azure.mgmt.deviceregistry.models.AssetStatusDataset": "Microsoft.DeviceRegistry.AssetStatusDataset", + "azure.mgmt.deviceregistry.models.AssetStatusError": "Microsoft.DeviceRegistry.AssetStatusError", + "azure.mgmt.deviceregistry.models.AssetStatusEvent": "Microsoft.DeviceRegistry.AssetStatusEvent", + "azure.mgmt.deviceregistry.models.AssetUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.deviceregistry.models.AssetUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.deviceregistry.models.Authentication": "Microsoft.DeviceRegistry.Authentication", + "azure.mgmt.deviceregistry.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.deviceregistry.models.BillingContainer": "Microsoft.DeviceRegistry.BillingContainer", + "azure.mgmt.deviceregistry.models.BillingContainerProperties": "Microsoft.DeviceRegistry.BillingContainerProperties", + "azure.mgmt.deviceregistry.models.DataPointBase": "Microsoft.DeviceRegistry.DataPointBase", + "azure.mgmt.deviceregistry.models.DataPoint": "Microsoft.DeviceRegistry.DataPoint", + "azure.mgmt.deviceregistry.models.Dataset": "Microsoft.DeviceRegistry.Dataset", + "azure.mgmt.deviceregistry.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.deviceregistry.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.deviceregistry.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.deviceregistry.models.EventBase": "Microsoft.DeviceRegistry.EventBase", + "azure.mgmt.deviceregistry.models.Event": "Microsoft.DeviceRegistry.Event", + "azure.mgmt.deviceregistry.models.ExtendedLocation": "Microsoft.DeviceRegistry.ExtendedLocation", + "azure.mgmt.deviceregistry.models.MessageSchemaReference": "Microsoft.DeviceRegistry.MessageSchemaReference", + "azure.mgmt.deviceregistry.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.deviceregistry.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.deviceregistry.models.OperationStatusResult": "Azure.ResourceManager.CommonTypes.OperationStatusResult", + "azure.mgmt.deviceregistry.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.deviceregistry.models.Topic": "Microsoft.DeviceRegistry.Topic", + "azure.mgmt.deviceregistry.models.UsernamePasswordCredentials": "Microsoft.DeviceRegistry.UsernamePasswordCredentials", + "azure.mgmt.deviceregistry.models.X509Credentials": "Microsoft.DeviceRegistry.X509Credentials", + "azure.mgmt.deviceregistry.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.deviceregistry.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.deviceregistry.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.deviceregistry.models.TopicRetainType": "Microsoft.DeviceRegistry.TopicRetainType", + "azure.mgmt.deviceregistry.models.DataPointObservabilityMode": "Microsoft.DeviceRegistry.DataPointObservabilityMode", + "azure.mgmt.deviceregistry.models.EventObservabilityMode": "Microsoft.DeviceRegistry.EventObservabilityMode", + "azure.mgmt.deviceregistry.models.ProvisioningState": "Microsoft.DeviceRegistry.ProvisioningState", + "azure.mgmt.deviceregistry.models.AuthenticationMethod": "Microsoft.DeviceRegistry.AuthenticationMethod", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.operation_status.get": "Microsoft.DeviceRegistry.OperationStatus.get", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.get": "Microsoft.DeviceRegistry.Assets.get", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.begin_create_or_replace": "Microsoft.DeviceRegistry.Assets.createOrReplace", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.begin_update": "Microsoft.DeviceRegistry.Assets.update", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.begin_delete": "Microsoft.DeviceRegistry.Assets.delete", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.list_by_resource_group": "Microsoft.DeviceRegistry.Assets.listByResourceGroup", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.list_by_subscription": "Microsoft.DeviceRegistry.Assets.listBySubscription", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.get": "Microsoft.DeviceRegistry.AssetEndpointProfiles.get", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.begin_create_or_replace": "Microsoft.DeviceRegistry.AssetEndpointProfiles.createOrReplace", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.begin_update": "Microsoft.DeviceRegistry.AssetEndpointProfiles.update", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.begin_delete": "Microsoft.DeviceRegistry.AssetEndpointProfiles.delete", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.list_by_resource_group": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listByResourceGroup", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.list_by_subscription": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listBySubscription", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.billing_containers.get": "Microsoft.DeviceRegistry.BillingContainers.get", + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.billing_containers.list_by_subscription": "Microsoft.DeviceRegistry.BillingContainers.listBySubscription" + } +} \ No newline at end of file diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py index dc5665916ce2..f55bd4306368 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py @@ -21,20 +21,15 @@ AssetEndpointProfilesOperations, AssetsOperations, BillingContainersOperations, - DiscoveredAssetEndpointProfilesOperations, - DiscoveredAssetsOperations, OperationStatusOperations, Operations, - SchemaRegistriesOperations, - SchemaVersionsOperations, - SchemasOperations, ) if TYPE_CHECKING: from azure.core.credentials import TokenCredential -class DeviceRegistryMgmtClient: # pylint: disable=too-many-instance-attributes +class DeviceRegistryMgmtClient: """Microsoft.DeviceRegistry Resource Provider management API. :ivar operations: Operations operations @@ -48,26 +43,14 @@ class DeviceRegistryMgmtClient: # pylint: disable=too-many-instance-attributes azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations :ivar billing_containers: BillingContainersOperations operations :vartype billing_containers: azure.mgmt.deviceregistry.operations.BillingContainersOperations - :ivar discovered_assets: DiscoveredAssetsOperations operations - :vartype discovered_assets: azure.mgmt.deviceregistry.operations.DiscoveredAssetsOperations - :ivar discovered_asset_endpoint_profiles: DiscoveredAssetEndpointProfilesOperations operations - :vartype discovered_asset_endpoint_profiles: - azure.mgmt.deviceregistry.operations.DiscoveredAssetEndpointProfilesOperations - :ivar schema_registries: SchemaRegistriesOperations operations - :vartype schema_registries: azure.mgmt.deviceregistry.operations.SchemaRegistriesOperations - :ivar schemas: SchemasOperations operations - :vartype schemas: azure.mgmt.deviceregistry.operations.SchemasOperations - :ivar schema_versions: SchemaVersionsOperations operations - :vartype schema_versions: azure.mgmt.deviceregistry.operations.SchemaVersionsOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2024-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-11-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -118,17 +101,6 @@ def __init__( self.billing_containers = BillingContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.discovered_assets = DiscoveredAssetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.discovered_asset_endpoint_profiles = DiscoveredAssetEndpointProfilesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.schema_registries = SchemaRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.schemas = SchemasOperations(self._client, self._config, self._serialize, self._deserialize) - self.schema_versions = SchemaVersionsOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_configuration.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_configuration.py index 3581d6e0d1e4..e8b9e79fe99f 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_configuration.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_configuration.py @@ -29,9 +29,8 @@ class DeviceRegistryMgmtClientConfiguration: # pylint: disable=too-many-instanc :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2024-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-11-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -42,7 +41,7 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_model_base.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_model_base.py index 6a6e1f38b17e..3072ee252ed9 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_model_base.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_model_base.py @@ -373,15 +373,34 @@ def __ne__(self, other: typing.Any) -> bool: return not self.__eq__(other) def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ return self._data.items() def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ try: return self[key] except KeyError: @@ -397,17 +416,38 @@ def pop(self, key: str, default: _T) -> _T: ... def pop(self, key: str, default: typing.Any) -> typing.Any: ... def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ if default is _UNSET: return self._data.pop(key) return self._data.pop(key, default) def popitem(self) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ return self._data.popitem() def clear(self) -> None: + """ + Remove all items from D. + """ self._data.clear() def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ self._data.update(*args, **kwargs) @typing.overload @@ -417,6 +457,13 @@ def setdefault(self, key: str, default: None = None) -> None: ... def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ if default is _UNSET: return self._data.setdefault(key) return self._data.setdefault(key, default) @@ -894,6 +941,35 @@ def _deserialize( return _deserialize_with_callable(deserializer, value) +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + class _RestField: def __init__( self, diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_serialization.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_serialization.py index e2ad51869908..e2a20b1d534c 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_serialization.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_serialization.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -48,9 +48,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -61,13 +59,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -185,73 +183,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -480,7 +412,7 @@ def from_dict( :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong - :rtype: ModelType + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -563,7 +495,7 @@ def _decode_attribute_map_key(key): return key.replace("\\.", ".") -class Serializer(object): # pylint: disable=too-many-public-methods +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -626,7 +558,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -736,8 +668,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +713,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +737,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +767,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +787,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1192,7 +1124,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1150,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1183,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1429,7 +1361,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1441,7 +1373,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1488,7 +1420,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1502,7 +1434,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1717,7 +1649,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1799,7 +1731,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1845,7 +1777,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1936,7 +1868,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1949,7 +1881,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1964,7 +1896,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1982,7 +1914,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1995,7 +1927,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2013,7 +1945,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2029,7 +1961,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2044,14 +1976,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2067,7 +1999,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2105,7 +2037,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py index bbcd28b4aa67..be71c81bd282 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py index df33c758758f..f64c7b20c23c 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py @@ -21,20 +21,15 @@ AssetEndpointProfilesOperations, AssetsOperations, BillingContainersOperations, - DiscoveredAssetEndpointProfilesOperations, - DiscoveredAssetsOperations, OperationStatusOperations, Operations, - SchemaRegistriesOperations, - SchemaVersionsOperations, - SchemasOperations, ) if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential -class DeviceRegistryMgmtClient: # pylint: disable=too-many-instance-attributes +class DeviceRegistryMgmtClient: """Microsoft.DeviceRegistry Resource Provider management API. :ivar operations: Operations operations @@ -49,26 +44,14 @@ class DeviceRegistryMgmtClient: # pylint: disable=too-many-instance-attributes :ivar billing_containers: BillingContainersOperations operations :vartype billing_containers: azure.mgmt.deviceregistry.aio.operations.BillingContainersOperations - :ivar discovered_assets: DiscoveredAssetsOperations operations - :vartype discovered_assets: azure.mgmt.deviceregistry.aio.operations.DiscoveredAssetsOperations - :ivar discovered_asset_endpoint_profiles: DiscoveredAssetEndpointProfilesOperations operations - :vartype discovered_asset_endpoint_profiles: - azure.mgmt.deviceregistry.aio.operations.DiscoveredAssetEndpointProfilesOperations - :ivar schema_registries: SchemaRegistriesOperations operations - :vartype schema_registries: azure.mgmt.deviceregistry.aio.operations.SchemaRegistriesOperations - :ivar schemas: SchemasOperations operations - :vartype schemas: azure.mgmt.deviceregistry.aio.operations.SchemasOperations - :ivar schema_versions: SchemaVersionsOperations operations - :vartype schema_versions: azure.mgmt.deviceregistry.aio.operations.SchemaVersionsOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2024-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-11-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -119,17 +102,6 @@ def __init__( self.billing_containers = BillingContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.discovered_assets = DiscoveredAssetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.discovered_asset_endpoint_profiles = DiscoveredAssetEndpointProfilesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.schema_registries = SchemaRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.schemas = SchemasOperations(self._client, self._config, self._serialize, self._deserialize) - self.schema_versions = SchemaVersionsOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_configuration.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_configuration.py index 7591864c83fc..0ab15551a249 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_configuration.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_configuration.py @@ -29,9 +29,8 @@ class DeviceRegistryMgmtClientConfiguration: # pylint: disable=too-many-instanc :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2024-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-11-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -42,7 +41,7 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/__init__.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/__init__.py index 04984dadf2ba..763af1696fc5 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/__init__.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/__init__.py @@ -17,11 +17,6 @@ from ._operations import AssetsOperations # type: ignore from ._operations import AssetEndpointProfilesOperations # type: ignore from ._operations import BillingContainersOperations # type: ignore -from ._operations import DiscoveredAssetsOperations # type: ignore -from ._operations import DiscoveredAssetEndpointProfilesOperations # type: ignore -from ._operations import SchemaRegistriesOperations # type: ignore -from ._operations import SchemasOperations # type: ignore -from ._operations import SchemaVersionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -33,11 +28,6 @@ "AssetsOperations", "AssetEndpointProfilesOperations", "BillingContainersOperations", - "DiscoveredAssetsOperations", - "DiscoveredAssetEndpointProfilesOperations", - "SchemaRegistriesOperations", - "SchemasOperations", - "SchemaVersionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 19c5e6fb471d..4fc1b5061e20 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 @@ -12,6 +12,7 @@ from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,7 +34,8 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize +from ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._serialization import Deserializer, Serializer from ..._validation import api_version_validation from ...operations._operations import ( build_asset_endpoint_profiles_create_or_replace_request, @@ -50,35 +52,10 @@ build_assets_update_request, build_billing_containers_get_request, build_billing_containers_list_by_subscription_request, - build_discovered_asset_endpoint_profiles_create_or_replace_request, - build_discovered_asset_endpoint_profiles_delete_request, - build_discovered_asset_endpoint_profiles_get_request, - build_discovered_asset_endpoint_profiles_list_by_resource_group_request, - build_discovered_asset_endpoint_profiles_list_by_subscription_request, - build_discovered_asset_endpoint_profiles_update_request, - build_discovered_assets_create_or_replace_request, - build_discovered_assets_delete_request, - build_discovered_assets_get_request, - build_discovered_assets_list_by_resource_group_request, - build_discovered_assets_list_by_subscription_request, - build_discovered_assets_update_request, build_operation_status_get_request, build_operations_list_request, - build_schema_registries_create_or_replace_request, - build_schema_registries_delete_request, - build_schema_registries_get_request, - build_schema_registries_list_by_resource_group_request, - build_schema_registries_list_by_subscription_request, - build_schema_registries_update_request, - build_schema_versions_create_or_replace_request, - build_schema_versions_delete_request, - build_schema_versions_get_request, - build_schema_versions_list_by_schema_request, - build_schemas_create_or_replace_request, - build_schemas_delete_request, - build_schemas_get_request, - build_schemas_list_by_schema_registry_request, ) +from .._configuration import DeviceRegistryMgmtClientConfiguration if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -101,10 +78,10 @@ class Operations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace @api_version_validation( @@ -185,7 +162,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -205,10 +182,10 @@ class OperationStatusOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async @api_version_validation( @@ -265,7 +242,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -291,10 +268,10 @@ class AssetsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async @api_version_validation( @@ -352,7 +329,7 @@ async def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -420,7 +397,7 @@ async def _create_or_replace_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -654,7 +631,7 @@ async def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -874,7 +851,7 @@ async def _delete_initial(self, resource_group_name: str, asset_name: str, **kwa except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1033,7 +1010,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1120,7 +1097,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1140,10 +1117,10 @@ class AssetEndpointProfilesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async @api_version_validation( @@ -1203,7 +1180,7 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1275,7 +1252,7 @@ async def _create_or_replace_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1517,7 +1494,7 @@ async def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1744,7 +1721,7 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1908,7 +1885,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1996,7 +1973,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2016,10 +1993,10 @@ class BillingContainersOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async @api_version_validation( @@ -2076,7 +2053,7 @@ async def get(self, billing_container_name: str, **kwargs: Any) -> _models.Billi except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -2171,3848 +2148,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class DiscoveredAssetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`discovered_assets` attribute. - """ - - 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_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - async def get(self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any) -> _models.DiscoveredAsset: - """Get a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :return: DiscoveredAsset. The DiscoveredAsset is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.DiscoveredAsset - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.DiscoveredAsset] = kwargs.pop("cls", None) - - _request = build_discovered_assets_get_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DiscoveredAsset, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - async def _create_or_replace_initial( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: Union[_models.DiscoveredAsset, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_assets_create_or_replace_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: _models.DiscoveredAsset, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAsset - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: Union[_models.DiscoveredAsset, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Is one of the following types: DiscoveredAsset, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAsset or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiscoveredAsset] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_replace_initial( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DiscoveredAsset, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DiscoveredAsset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiscoveredAsset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - async def _update_initial( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: Union[_models.DiscoveredAssetUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_assets_update_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: _models.DiscoveredAssetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - async def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: Union[_models.DiscoveredAssetUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DiscoveredAssetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiscoveredAsset] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - properties=properties, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DiscoveredAsset, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DiscoveredAsset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiscoveredAsset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - async def _delete_initial( - self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_discovered_assets_delete_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - async def begin_delete( - self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, - ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DiscoveredAsset"]: - """List DiscoveredAsset resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiscoveredAsset - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAsset]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_discovered_assets_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAsset], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DiscoveredAsset"]: - """List DiscoveredAsset resources by subscription ID. - - :return: An iterator like instance of DiscoveredAsset - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAsset]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_discovered_assets_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAsset], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class DiscoveredAssetEndpointProfilesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`discovered_asset_endpoint_profiles` attribute. - """ - - 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_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - async def get( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> _models.DiscoveredAssetEndpointProfile: - """Get a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :return: DiscoveredAssetEndpointProfile. The DiscoveredAssetEndpointProfile is compatible with - MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.DiscoveredAssetEndpointProfile] = kwargs.pop("cls", None) - - _request = build_discovered_asset_endpoint_profiles_get_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DiscoveredAssetEndpointProfile, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - async def _create_or_replace_initial( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: Union[_models.DiscoveredAssetEndpointProfile, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_asset_endpoint_profiles_create_or_replace_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: _models.DiscoveredAssetEndpointProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: Union[_models.DiscoveredAssetEndpointProfile, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Is one of the following types: - DiscoveredAssetEndpointProfile, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiscoveredAssetEndpointProfile] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_replace_initial( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DiscoveredAssetEndpointProfile, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DiscoveredAssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - async def _update_initial( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: Union[_models.DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_asset_endpoint_profiles_update_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: _models.DiscoveredAssetEndpointProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - async def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: Union[_models.DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate or - JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiscoveredAssetEndpointProfile] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - properties=properties, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DiscoveredAssetEndpointProfile, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DiscoveredAssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - async def _delete_initial( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_discovered_asset_endpoint_profiles_delete_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - async def begin_delete( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, - ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DiscoveredAssetEndpointProfile"]: - """List DiscoveredAssetEndpointProfile resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiscoveredAssetEndpointProfile - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAssetEndpointProfile]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_discovered_asset_endpoint_profiles_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAssetEndpointProfile], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DiscoveredAssetEndpointProfile"]: - """List DiscoveredAssetEndpointProfile resources by subscription ID. - - :return: An iterator like instance of DiscoveredAssetEndpointProfile - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAssetEndpointProfile]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_discovered_asset_endpoint_profiles_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAssetEndpointProfile], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class SchemaRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`schema_registries` attribute. - """ - - 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_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, - ) - async def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any) -> _models.SchemaRegistry: - """Get a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :return: SchemaRegistry. The SchemaRegistry is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaRegistry - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.SchemaRegistry] = kwargs.pop("cls", None) - - _request = build_schema_registries_get_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SchemaRegistry, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, - ) - async def _create_or_replace_initial( - self, - resource_group_name: str, - schema_registry_name: str, - resource: Union[_models.SchemaRegistry, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schema_registries_create_or_replace_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: _models.SchemaRegistry, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaRegistry - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, - ) - async def begin_create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: Union[_models.SchemaRegistry, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Is one of the following types: SchemaRegistry, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaRegistry or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SchemaRegistry] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_replace_initial( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.SchemaRegistry, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.SchemaRegistry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SchemaRegistry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, - ) - async def _update_initial( - self, - resource_group_name: str, - schema_registry_name: str, - properties: Union[_models.SchemaRegistryUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schema_registries_update_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - schema_registry_name: str, - properties: _models.SchemaRegistryUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - schema_registry_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - schema_registry_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, - ) - async def begin_update( - self, - resource_group_name: str, - schema_registry_name: str, - properties: Union[_models.SchemaRegistryUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param properties: The resource properties to be updated. Is one of the following types: - SchemaRegistryUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SchemaRegistry] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - properties=properties, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.SchemaRegistry, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.SchemaRegistry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SchemaRegistry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, - ) - async def _delete_initial( - self, resource_group_name: str, schema_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_schema_registries_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, - ) - async def begin_delete( - self, resource_group_name: str, schema_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, - ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SchemaRegistry"]: - """List SchemaRegistry resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of SchemaRegistry - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SchemaRegistry]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_schema_registries_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SchemaRegistry], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SchemaRegistry"]: - """List SchemaRegistry resources by subscription ID. - - :return: An iterator like instance of SchemaRegistry - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SchemaRegistry]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_schema_registries_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SchemaRegistry], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class SchemasOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`schemas` attribute. - """ - - 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_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, - ) - async def get( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> _models.Schema: - """Get a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Schema] = kwargs.pop("cls", None) - - _request = build_schemas_get_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Schema, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: _models.Schema, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schema: - """Create a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.Schema - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schema: - """Create a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schema: - """Create a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "content_type", - "accept", - ] - }, - ) - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: Union[_models.Schema, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.Schema: - """Create a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Is one of the following types: Schema, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.Schema or JSON or IO[bytes] - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Schema] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schemas_create_or_replace_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Schema, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, - ) - async def delete( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> None: - """Delete a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_schemas_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, - ) - def list_by_schema_registry( - self, resource_group_name: str, schema_registry_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Schema"]: - """List Schema resources by SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :return: An iterator like instance of Schema - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.Schema] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Schema]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_schemas_list_by_schema_registry_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Schema], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class SchemaVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`schema_versions` attribute. - """ - - 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_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "accept", - ] - }, - ) - async def get( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - **kwargs: Any - ) -> _models.SchemaVersion: - """Get a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.SchemaVersion] = kwargs.pop("cls", None) - - _request = build_schema_versions_get_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SchemaVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: _models.SchemaVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "content_type", - "accept", - ] - }, - ) - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: Union[_models.SchemaVersion, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Is one of the following types: SchemaVersion, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaVersion or JSON or IO[bytes] - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SchemaVersion] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schema_versions_create_or_replace_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SchemaVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "accept", - ] - }, - ) - async def delete( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - **kwargs: Any - ) -> None: - """Delete a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_schema_versions_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, - ) - def list_by_schema( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SchemaVersion"]: - """List SchemaVersion resources by Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: An iterator like instance of SchemaVersion - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.SchemaVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SchemaVersion]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_schema_versions_list_by_schema_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SchemaVersion], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 37b8186abf06..468137044b23 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 @@ -34,17 +34,6 @@ DataPoint, DataPointBase, Dataset, - DiscoveredAsset, - DiscoveredAssetEndpointProfile, - DiscoveredAssetEndpointProfileProperties, - DiscoveredAssetEndpointProfileUpdate, - DiscoveredAssetEndpointProfileUpdateProperties, - DiscoveredAssetProperties, - DiscoveredAssetUpdate, - DiscoveredAssetUpdateProperties, - DiscoveredDataPoint, - DiscoveredDataset, - DiscoveredEvent, ErrorAdditionalInfo, ErrorDetail, ErrorResponse, @@ -57,15 +46,6 @@ OperationStatusResult, ProxyResource, Resource, - Schema, - SchemaProperties, - SchemaRegistry, - SchemaRegistryProperties, - SchemaRegistryUpdate, - SchemaRegistryUpdateProperties, - SchemaVersion, - SchemaVersionProperties, - SystemAssignedServiceIdentity, SystemData, Topic, TrackedResource, @@ -79,11 +59,8 @@ CreatedByType, DataPointObservabilityMode, EventObservabilityMode, - Format, Origin, ProvisioningState, - SchemaType, - SystemAssignedServiceIdentityType, TopicRetainType, ) from ._patch import __all__ as _patch_all @@ -111,17 +88,6 @@ "DataPoint", "DataPointBase", "Dataset", - "DiscoveredAsset", - "DiscoveredAssetEndpointProfile", - "DiscoveredAssetEndpointProfileProperties", - "DiscoveredAssetEndpointProfileUpdate", - "DiscoveredAssetEndpointProfileUpdateProperties", - "DiscoveredAssetProperties", - "DiscoveredAssetUpdate", - "DiscoveredAssetUpdateProperties", - "DiscoveredDataPoint", - "DiscoveredDataset", - "DiscoveredEvent", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -134,15 +100,6 @@ "OperationStatusResult", "ProxyResource", "Resource", - "Schema", - "SchemaProperties", - "SchemaRegistry", - "SchemaRegistryProperties", - "SchemaRegistryUpdate", - "SchemaRegistryUpdateProperties", - "SchemaVersion", - "SchemaVersionProperties", - "SystemAssignedServiceIdentity", "SystemData", "Topic", "TrackedResource", @@ -153,11 +110,8 @@ "CreatedByType", "DataPointObservabilityMode", "EventObservabilityMode", - "Format", "Origin", "ProvisioningState", - "SchemaType", - "SystemAssignedServiceIdentityType", "TopicRetainType", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_enums.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_enums.py index 2e272e8503d8..5d45ddc47177 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_enums.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_enums.py @@ -67,15 +67,6 @@ class EventObservabilityMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Map as log to OpenTelemetry.""" -class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Defines the schema format.""" - - JSON_SCHEMA_DRAFT7 = "JsonSchema/draft-07" - """JSON Schema version draft 7 format""" - DELTA1_0 = "Delta/1.0" - """Delta format""" - - 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". @@ -104,22 +95,6 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource is deleting.""" -class SchemaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Defines the schema type.""" - - MESSAGE_SCHEMA = "MessageSchema" - """Message Schema schema type""" - - -class SystemAssignedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (either system assigned, or none).""" - - NONE = "None" - """No managed system identity.""" - SYSTEM_ASSIGNED = "SystemAssigned" - """System assigned managed system identity.""" - - class TopicRetainType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Topic retain types.""" diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py index 1d8c8ed5424f..1e48551e1d25 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +24,7 @@ class Resource(_model_base.Model): Readonly variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -38,7 +38,7 @@ class Resource(_model_base.Model): id: Optional[str] = rest_field(visibility=["read"]) """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" name: Optional[str] = rest_field(visibility=["read"]) """The name of the resource.""" type: Optional[str] = rest_field(visibility=["read"]) @@ -56,7 +56,7 @@ class TrackedResource(Resource): :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -72,7 +72,7 @@ class TrackedResource(Resource): :vartype location: str """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" location: str = rest_field(visibility=["read", "create"]) """The geo-location where the resource lives. Required.""" @@ -103,7 +103,7 @@ class Asset(TrackedResource): :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -123,7 +123,9 @@ class Asset(TrackedResource): :vartype extended_location: ~azure.mgmt.deviceregistry.models.ExtendedLocation """ - properties: Optional["_models.AssetProperties"] = rest_field() + properties: Optional["_models.AssetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) """The extended location. Required.""" @@ -156,7 +158,7 @@ class AssetEndpointProfile(TrackedResource): :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -176,7 +178,9 @@ class AssetEndpointProfile(TrackedResource): :vartype extended_location: ~azure.mgmt.deviceregistry.models.ExtendedLocation """ - properties: Optional["_models.AssetEndpointProfileProperties"] = rest_field() + properties: Optional["_models.AssetEndpointProfileProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) """The extended location. Required.""" @@ -237,16 +241,22 @@ class AssetEndpointProfileProperties(_model_base.Model): uuid: Optional[str] = rest_field(visibility=["read"]) """Globally unique, immutable, non-reusable id.""" - target_address: str = rest_field(name="targetAddress") + target_address: str = rest_field(name="targetAddress", visibility=["read", "create", "update", "delete", "query"]) """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. Required.""" - endpoint_profile_type: str = rest_field(name="endpointProfileType") + endpoint_profile_type: str = rest_field( + name="endpointProfileType", visibility=["read", "create", "update", "delete", "query"] + ) """Defines the configuration for the connector type that is being used with the endpoint profile. Required.""" - authentication: Optional["_models.Authentication"] = rest_field() + authentication: Optional["_models.Authentication"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Defines the client authentication mechanism to the server.""" - additional_configuration: Optional[str] = rest_field(name="additionalConfiguration") + additional_configuration: Optional[str] = rest_field( + name="additionalConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) """Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF).""" discovered_asset_endpoint_profile_ref: Optional[str] = rest_field( @@ -326,9 +336,11 @@ class AssetEndpointProfileUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdateProperties """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" - properties: Optional["_models.AssetEndpointProfileUpdateProperties"] = rest_field() + properties: Optional["_models.AssetEndpointProfileUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -367,15 +379,23 @@ class AssetEndpointProfileUpdateProperties(_model_base.Model): :vartype additional_configuration: str """ - target_address: Optional[str] = rest_field(name="targetAddress") + target_address: Optional[str] = rest_field( + name="targetAddress", visibility=["read", "create", "update", "delete", "query"] + ) """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.""" - endpoint_profile_type: Optional[str] = rest_field(name="endpointProfileType") + endpoint_profile_type: Optional[str] = rest_field( + name="endpointProfileType", visibility=["read", "create", "update", "delete", "query"] + ) """Defines the configuration for the connector type that is being used with the endpoint profile.""" - authentication: Optional["_models.Authentication"] = rest_field() + authentication: Optional["_models.Authentication"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Defines the client authentication mechanism to the server.""" - additional_configuration: Optional[str] = rest_field(name="additionalConfiguration") + additional_configuration: Optional[str] = rest_field( + name="additionalConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) """Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF).""" @@ -469,13 +489,15 @@ class AssetProperties(_model_base.Model): uuid: Optional[str] = rest_field(visibility=["read"]) """Globally unique, immutable, non-reusable id.""" - enabled: Optional[bool] = rest_field() + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Enabled/Disabled status of the asset.""" external_asset_id: Optional[str] = rest_field(name="externalAssetId", visibility=["read", "create"]) """Asset id provided by the customer.""" - display_name: Optional[str] = rest_field(name="displayName") + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) """Human-readable display name.""" - description: Optional[str] = rest_field() + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Human-readable description of the asset.""" asset_endpoint_profile_ref: str = rest_field(name="assetEndpointProfileRef", visibility=["read", "create"]) """A reference to the asset endpoint profile (connection information) used by brokers to connect @@ -483,39 +505,57 @@ class AssetProperties(_model_base.Model): name. Required.""" version: Optional[int] = rest_field(visibility=["read"]) """An integer that is incremented each time the resource is modified.""" - manufacturer: Optional[str] = rest_field() + manufacturer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Asset manufacturer name.""" - manufacturer_uri: Optional[str] = rest_field(name="manufacturerUri") + manufacturer_uri: Optional[str] = rest_field( + name="manufacturerUri", visibility=["read", "create", "update", "delete", "query"] + ) """Asset manufacturer URI.""" - model: Optional[str] = rest_field() + model: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Asset model name.""" - product_code: Optional[str] = rest_field(name="productCode") + product_code: Optional[str] = rest_field( + name="productCode", visibility=["read", "create", "update", "delete", "query"] + ) """Asset product code.""" - hardware_revision: Optional[str] = rest_field(name="hardwareRevision") + hardware_revision: Optional[str] = rest_field( + name="hardwareRevision", visibility=["read", "create", "update", "delete", "query"] + ) """Revision number of the hardware.""" - software_revision: Optional[str] = rest_field(name="softwareRevision") + software_revision: Optional[str] = rest_field( + name="softwareRevision", visibility=["read", "create", "update", "delete", "query"] + ) """Revision number of the software.""" - documentation_uri: Optional[str] = rest_field(name="documentationUri") + documentation_uri: Optional[str] = rest_field( + name="documentationUri", visibility=["read", "create", "update", "delete", "query"] + ) """Reference to the documentation.""" - serial_number: Optional[str] = rest_field(name="serialNumber") + serial_number: Optional[str] = rest_field( + name="serialNumber", visibility=["read", "create", "update", "delete", "query"] + ) """Asset serial number.""" - attributes: Optional[Dict[str, Any]] = rest_field() + attributes: Optional[Dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """A set of key-value pairs that contain custom attributes set by the customer.""" discovered_asset_refs: Optional[List[str]] = rest_field(name="discoveredAssetRefs", visibility=["read", "create"]) """Reference to a list of discovered assets. Populated only if the asset has been created from discovery flow. Discovered asset names must be provided.""" - default_datasets_configuration: Optional[str] = rest_field(name="defaultDatasetsConfiguration") + default_datasets_configuration: Optional[str] = rest_field( + name="defaultDatasetsConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) """Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here.""" - default_events_configuration: Optional[str] = rest_field(name="defaultEventsConfiguration") + default_events_configuration: Optional[str] = rest_field( + name="defaultEventsConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) """Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here.""" - default_topic: Optional["_models.Topic"] = rest_field(name="defaultTopic") + default_topic: Optional["_models.Topic"] = rest_field( + name="defaultTopic", visibility=["read", "create", "update", "delete", "query"] + ) """Object that describes the default topic information for the asset.""" - datasets: Optional[List["_models.Dataset"]] = rest_field() + datasets: Optional[List["_models.Dataset"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Array of datasets that are part of the asset. Each dataset describes the data points that make up the set.""" - events: Optional[List["_models.Event"]] = rest_field() + events: Optional[List["_models.Event"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Array of events that are part of the asset. Each event can have per-event configuration.""" status: Optional["_models.AssetStatus"] = rest_field(visibility=["read"]) """Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes @@ -666,9 +706,11 @@ class AssetUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.deviceregistry.models.AssetUpdateProperties """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" - properties: Optional["_models.AssetUpdateProperties"] = rest_field() + properties: Optional["_models.AssetUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -735,42 +777,62 @@ class AssetUpdateProperties(_model_base.Model): :vartype events: list[~azure.mgmt.deviceregistry.models.Event] """ - enabled: Optional[bool] = rest_field() + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Enabled/Disabled status of the asset.""" - display_name: Optional[str] = rest_field(name="displayName") + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) """Human-readable display name.""" - description: Optional[str] = rest_field() + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Human-readable description of the asset.""" - manufacturer: Optional[str] = rest_field() + manufacturer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Asset manufacturer name.""" - manufacturer_uri: Optional[str] = rest_field(name="manufacturerUri") + manufacturer_uri: Optional[str] = rest_field( + name="manufacturerUri", visibility=["read", "create", "update", "delete", "query"] + ) """Asset manufacturer URI.""" - model: Optional[str] = rest_field() + model: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Asset model name.""" - product_code: Optional[str] = rest_field(name="productCode") + product_code: Optional[str] = rest_field( + name="productCode", visibility=["read", "create", "update", "delete", "query"] + ) """Asset product code.""" - hardware_revision: Optional[str] = rest_field(name="hardwareRevision") + hardware_revision: Optional[str] = rest_field( + name="hardwareRevision", visibility=["read", "create", "update", "delete", "query"] + ) """Revision number of the hardware.""" - software_revision: Optional[str] = rest_field(name="softwareRevision") + software_revision: Optional[str] = rest_field( + name="softwareRevision", visibility=["read", "create", "update", "delete", "query"] + ) """Revision number of the software.""" - documentation_uri: Optional[str] = rest_field(name="documentationUri") + documentation_uri: Optional[str] = rest_field( + name="documentationUri", visibility=["read", "create", "update", "delete", "query"] + ) """Reference to the documentation.""" - serial_number: Optional[str] = rest_field(name="serialNumber") + serial_number: Optional[str] = rest_field( + name="serialNumber", visibility=["read", "create", "update", "delete", "query"] + ) """Asset serial number.""" - attributes: Optional[Dict[str, Any]] = rest_field() + attributes: Optional[Dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """A set of key-value pairs that contain custom attributes set by the customer.""" - default_datasets_configuration: Optional[str] = rest_field(name="defaultDatasetsConfiguration") + default_datasets_configuration: Optional[str] = rest_field( + name="defaultDatasetsConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) """Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here.""" - default_events_configuration: Optional[str] = rest_field(name="defaultEventsConfiguration") + default_events_configuration: Optional[str] = rest_field( + name="defaultEventsConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) """Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here.""" - default_topic: Optional["_models.Topic"] = rest_field(name="defaultTopic") + default_topic: Optional["_models.Topic"] = rest_field( + name="defaultTopic", visibility=["read", "create", "update", "delete", "query"] + ) """Object that describes the default topic information for the asset.""" - datasets: Optional[List["_models.Dataset"]] = rest_field() + datasets: Optional[List["_models.Dataset"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Array of datasets that are part of the asset. Each dataset describes the data points that make up the set.""" - events: Optional[List["_models.Event"]] = rest_field() + events: Optional[List["_models.Event"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Array of events that are part of the asset. Each event can have per-event configuration.""" @overload @@ -823,15 +885,19 @@ class Authentication(_model_base.Model): :vartype x509_credentials: ~azure.mgmt.deviceregistry.models.X509Credentials """ - method: Union[str, "_models.AuthenticationMethod"] = rest_field() + method: Union[str, "_models.AuthenticationMethod"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Defines the method to authenticate the user of the client at the server. Required. Known values are: \"Anonymous\", \"Certificate\", and \"UsernamePassword\".""" username_password_credentials: Optional["_models.UsernamePasswordCredentials"] = rest_field( - name="usernamePasswordCredentials" + name="usernamePasswordCredentials", visibility=["read", "create", "update", "delete", "query"] ) """Defines the username and password references when UsernamePassword user authentication mode is selected.""" - x509_credentials: Optional["_models.X509Credentials"] = rest_field(name="x509Credentials") + x509_credentials: Optional["_models.X509Credentials"] = rest_field( + name="x509Credentials", visibility=["read", "create", "update", "delete", "query"] + ) """Defines the certificate reference when Certificate user authentication mode is selected.""" @overload @@ -861,7 +927,7 @@ class ProxyResource(Resource): Readonly variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -881,7 +947,7 @@ class BillingContainer(ProxyResource): Readonly variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -897,7 +963,9 @@ class BillingContainer(ProxyResource): :vartype etag: str """ - properties: Optional["_models.BillingContainerProperties"] = rest_field() + properties: Optional["_models.BillingContainerProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" etag: Optional[str] = rest_field(visibility=["read"]) """Resource ETag.""" @@ -952,12 +1020,14 @@ class DataPointBase(_model_base.Model): :vartype data_point_configuration: str """ - name: str = rest_field() + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the data point. Required.""" - data_source: str = rest_field(name="dataSource") + data_source: str = rest_field(name="dataSource", visibility=["read", "create", "update", "delete", "query"]) """The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. Required.""" - data_point_configuration: Optional[str] = rest_field(name="dataPointConfiguration") + data_point_configuration: Optional[str] = rest_field( + name="dataPointConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) """Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize.""" @@ -1001,7 +1071,7 @@ class DataPoint(DataPointBase): """ observability_mode: Optional[Union[str, "_models.DataPointObservabilityMode"]] = rest_field( - name="observabilityMode" + name="observabilityMode", visibility=["read", "create", "update", "delete", "query"] ) """An indication of how the data point should be mapped to OpenTelemetry. Known values are: \"None\", \"Counter\", \"Gauge\", \"Histogram\", and \"Log\".""" @@ -1043,14 +1113,18 @@ class Dataset(_model_base.Model): :vartype data_points: list[~azure.mgmt.deviceregistry.models.DataPoint] """ - name: str = rest_field() + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Name of the dataset. Required.""" - dataset_configuration: Optional[str] = rest_field(name="datasetConfiguration") + dataset_configuration: Optional[str] = rest_field( + name="datasetConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) """Stringified JSON that contains connector-specific JSON string that describes configuration for the specific dataset.""" - topic: Optional["_models.Topic"] = rest_field() + topic: Optional["_models.Topic"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Object that describes the topic information for the specific dataset.""" - data_points: Optional[List["_models.DataPoint"]] = rest_field(name="dataPoints") + data_points: Optional[List["_models.DataPoint"]] = rest_field( + name="dataPoints", visibility=["read", "create", "update", "delete", "query"] + ) """Array of data points that are part of the dataset. Each data point can have per-data point configuration.""" @@ -1075,46 +1149,70 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DiscoveredAsset(TrackedResource): - """Discovered Asset definition. +class ErrorAdditionalInfo(_model_base.Model): + """The resource management error additional info. Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: The additional info type. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetProperties - :ivar extended_location: The extended location. Required. - :vartype extended_location: ~azure.mgmt.deviceregistry.models.ExtendedLocation + :ivar info: The additional info. + :vartype info: any """ - properties: Optional["_models.DiscoveredAssetProperties"] = rest_field() - """The resource-specific properties for this resource.""" - extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) - """The extended location. Required.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_model_base.Model): + """The error detail. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.deviceregistry.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.deviceregistry.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[List["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_model_base.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.deviceregistry.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" @overload def __init__( self, *, - location: str, - extended_location: "_models.ExtendedLocation", - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.DiscoveredAssetProperties"] = None, + error: Optional["_models.ErrorDetail"] = None, ) -> None: ... @overload @@ -1128,46 +1226,44 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DiscoveredAssetEndpointProfile(TrackedResource): - """Discovered Asset Endpoint Profile definition. - - Readonly variables are only populated by the server, and will be ignored when sending a request. +class EventBase(_model_base.Model): + """Defines the event properties. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. + :ivar name: The name of the event. Required. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileProperties - :ivar extended_location: The extended location. Required. - :vartype extended_location: ~azure.mgmt.deviceregistry.models.ExtendedLocation + :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that + a client can access the event on the asset. Required. + :vartype event_notifier: str + :ivar event_configuration: Stringified JSON that contains connector-specific configuration for + the event. For OPC UA, this could include configuration like, publishingInterval, + samplingInterval, and queueSize. + :vartype event_configuration: str + :ivar topic: Object that describes the topic information for the specific event. + :vartype topic: ~azure.mgmt.deviceregistry.models.Topic """ - properties: Optional["_models.DiscoveredAssetEndpointProfileProperties"] = rest_field() - """The resource-specific properties for this resource.""" - extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) - """The extended location. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the event. Required.""" + event_notifier: str = rest_field(name="eventNotifier", visibility=["read", "create", "update", "delete", "query"]) + """The address of the notifier of the event in the asset (e.g. URL) so that a client can access + the event on the asset. Required.""" + event_configuration: Optional[str] = rest_field( + name="eventConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this + could include configuration like, publishingInterval, samplingInterval, and queueSize.""" + topic: Optional["_models.Topic"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Object that describes the topic information for the specific event.""" @overload def __init__( self, *, - location: str, - extended_location: "_models.ExtendedLocation", - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.DiscoveredAssetEndpointProfileProperties"] = None, + name: str, + event_notifier: str, + event_configuration: Optional[str] = None, + topic: Optional["_models.Topic"] = None, ) -> None: ... @overload @@ -1181,70 +1277,41 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DiscoveredAssetEndpointProfileProperties(_model_base.Model): - """Defines the Discovered Asset Endpoint Profile properties. - - Readonly variables are only populated by the server, and will be ignored when sending a request. +class Event(EventBase): + """Defines the event properties. - :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. - Required. - :vartype target_address: str - :ivar additional_configuration: Stringified JSON that contains connectivity type specific - further configuration (e.g. OPC UA, Modbus, ONVIF). - :vartype additional_configuration: str - :ivar supported_authentication_methods: List of supported authentication methods supported by - the target server. - :vartype supported_authentication_methods: list[str or - ~azure.mgmt.deviceregistry.models.AuthenticationMethod] - :ivar endpoint_profile_type: Defines the configuration for the connector type that is being - used with the endpoint profile. Required. - :vartype endpoint_profile_type: str - :ivar discovery_id: Identifier used to detect changes in the asset endpoint profile. Required. - :vartype discovery_id: str - :ivar version: An integer that is incremented each time the resource is modified. Required. - :vartype version: int - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState + :ivar name: The name of the event. Required. + :vartype name: str + :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that + a client can access the event on the asset. Required. + :vartype event_notifier: str + :ivar event_configuration: Stringified JSON that contains connector-specific configuration for + the event. For OPC UA, this could include configuration like, publishingInterval, + samplingInterval, and queueSize. + :vartype event_configuration: str + :ivar topic: Object that describes the topic information for the specific event. + :vartype topic: ~azure.mgmt.deviceregistry.models.Topic + :ivar observability_mode: An indication of how the event should be mapped to OpenTelemetry. + Known values are: "None" and "Log". + :vartype observability_mode: str or ~azure.mgmt.deviceregistry.models.EventObservabilityMode """ - target_address: str = rest_field(name="targetAddress") - """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. Required.""" - additional_configuration: Optional[str] = rest_field(name="additionalConfiguration") - """Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, - Modbus, ONVIF).""" - supported_authentication_methods: Optional[List[Union[str, "_models.AuthenticationMethod"]]] = rest_field( - name="supportedAuthenticationMethods" - ) - """List of supported authentication methods supported by the target server.""" - endpoint_profile_type: str = rest_field(name="endpointProfileType") - """Defines the configuration for the connector type that is being used with the endpoint profile. - Required.""" - discovery_id: str = rest_field(name="discoveryId") - """Identifier used to detect changes in the asset endpoint profile. Required.""" - version: int = rest_field() - """An integer that is incremented each time the resource is modified. Required.""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] + observability_mode: Optional[Union[str, "_models.EventObservabilityMode"]] = rest_field( + name="observabilityMode", visibility=["read", "create", "update", "delete", "query"] ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" + """An indication of how the event should be mapped to OpenTelemetry. Known values are: \"None\" + and \"Log\".""" @overload def __init__( self, *, - target_address: str, - endpoint_profile_type: str, - discovery_id: str, - version: int, - additional_configuration: Optional[str] = None, - supported_authentication_methods: Optional[List[Union[str, "_models.AuthenticationMethod"]]] = None, + name: str, + event_notifier: str, + event_configuration: Optional[str] = None, + topic: Optional["_models.Topic"] = None, + observability_mode: Optional[Union[str, "_models.EventObservabilityMode"]] = None, ) -> None: ... @overload @@ -1258,27 +1325,27 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DiscoveredAssetEndpointProfileUpdate(_model_base.Model): - """The type used for update operations of the DiscoveredAssetEndpointProfile. +class ExtendedLocation(_model_base.Model): + """The extended location. + - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdateProperties + :ivar type: The extended location type. Required. + :vartype type: str + :ivar name: The extended location name. Required. + :vartype name: str """ - tags: Optional[Dict[str, str]] = rest_field() - """Resource tags.""" - properties: Optional["_models.DiscoveredAssetEndpointProfileUpdateProperties"] = rest_field() - """The resource-specific properties for this resource.""" + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The extended location type. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The extended location name. Required.""" @overload def __init__( self, *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.DiscoveredAssetEndpointProfileUpdateProperties"] = None, + type: str, + name: str, ) -> None: ... @overload @@ -1292,1187 +1359,74 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DiscoveredAssetEndpointProfileUpdateProperties(_model_base.Model): # pylint: disable=name-too-long - """The updatable properties of the DiscoveredAssetEndpointProfile. +class MessageSchemaReference(_model_base.Model): + """Defines the message schema reference properties. - :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 additional_configuration: Stringified JSON that contains connectivity type specific - further configuration (e.g. OPC UA, Modbus, ONVIF). - :vartype additional_configuration: str - :ivar supported_authentication_methods: List of supported authentication methods supported by - the target server. - :vartype supported_authentication_methods: list[str or - ~azure.mgmt.deviceregistry.models.AuthenticationMethod] - :ivar endpoint_profile_type: Defines the configuration for the connector type that is being - used with the endpoint profile. - :vartype endpoint_profile_type: str - :ivar discovery_id: Identifier used to detect changes in the asset endpoint profile. - :vartype discovery_id: str - :ivar version: An integer that is incremented each time the resource is modified. - :vartype version: int - """ + Readonly variables are only populated by the server, and will be ignored when sending a request. - target_address: Optional[str] = rest_field(name="targetAddress") - """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.""" - additional_configuration: Optional[str] = rest_field(name="additionalConfiguration") - """Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, - Modbus, ONVIF).""" - supported_authentication_methods: Optional[List[Union[str, "_models.AuthenticationMethod"]]] = rest_field( - name="supportedAuthenticationMethods" - ) - """List of supported authentication methods supported by the target server.""" - endpoint_profile_type: Optional[str] = rest_field(name="endpointProfileType") - """Defines the configuration for the connector type that is being used with the endpoint profile.""" - discovery_id: Optional[str] = rest_field(name="discoveryId") - """Identifier used to detect changes in the asset endpoint profile.""" - version: Optional[int] = rest_field() - """An integer that is incremented each time the resource is modified.""" - @overload - def __init__( - self, - *, - target_address: Optional[str] = None, - additional_configuration: Optional[str] = None, - supported_authentication_methods: Optional[List[Union[str, "_models.AuthenticationMethod"]]] = None, - endpoint_profile_type: Optional[str] = None, - discovery_id: Optional[str] = None, - version: Optional[int] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class DiscoveredAssetProperties(_model_base.Model): - """Defines the discovered asset properties. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar asset_endpoint_profile_ref: A reference to the asset endpoint profile (connection - information) used by brokers to connect to an endpoint that provides data points for this - asset. Must provide asset endpoint profile name. Required. - :vartype asset_endpoint_profile_ref: str - :ivar discovery_id: Identifier used to detect changes in the asset. Required. - :vartype discovery_id: str - :ivar version: An integer that is incremented each time the resource is modified. Required. - :vartype version: int - :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 default_datasets_configuration: Stringified JSON that contains connector-specific default - configuration for all datasets. Each dataset can have its own configuration that overrides the - default settings here. - :vartype default_datasets_configuration: str - :ivar default_events_configuration: Stringified JSON that contains connector-specific default - configuration for all events. Each event can have its own configuration that overrides the - default settings here. - :vartype default_events_configuration: str - :ivar default_topic: Object that describes the default topic information for the asset. - :vartype default_topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar datasets: Array of datasets that are part of the asset. Each dataset spec describes the - data points that make up the set. - :vartype datasets: list[~azure.mgmt.deviceregistry.models.DiscoveredDataset] - :ivar events: Array of events that are part of the asset. Each event can have per-event - configuration. - :vartype events: list[~azure.mgmt.deviceregistry.models.DiscoveredEvent] - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState - """ - - asset_endpoint_profile_ref: str = rest_field(name="assetEndpointProfileRef", visibility=["read", "create"]) - """A reference to the asset endpoint profile (connection information) used by brokers to connect - to an endpoint that provides data points for this asset. Must provide asset endpoint profile - name. Required.""" - discovery_id: str = rest_field(name="discoveryId") - """Identifier used to detect changes in the asset. Required.""" - version: int = rest_field() - """An integer that is incremented each time the resource is modified. Required.""" - manufacturer: Optional[str] = rest_field() - """Asset manufacturer name.""" - manufacturer_uri: Optional[str] = rest_field(name="manufacturerUri") - """Asset manufacturer URI.""" - model: Optional[str] = rest_field() - """Asset model name.""" - product_code: Optional[str] = rest_field(name="productCode") - """Asset product code.""" - hardware_revision: Optional[str] = rest_field(name="hardwareRevision") - """Revision number of the hardware.""" - software_revision: Optional[str] = rest_field(name="softwareRevision") - """Revision number of the software.""" - documentation_uri: Optional[str] = rest_field(name="documentationUri") - """Reference to the documentation.""" - serial_number: Optional[str] = rest_field(name="serialNumber") - """Asset serial number.""" - default_datasets_configuration: Optional[str] = rest_field(name="defaultDatasetsConfiguration") - """Stringified JSON that contains connector-specific default configuration for all datasets. Each - dataset can have its own configuration that overrides the default settings here.""" - default_events_configuration: Optional[str] = rest_field(name="defaultEventsConfiguration") - """Stringified JSON that contains connector-specific default configuration for all events. Each - event can have its own configuration that overrides the default settings here.""" - default_topic: Optional["_models.Topic"] = rest_field(name="defaultTopic") - """Object that describes the default topic information for the asset.""" - datasets: Optional[List["_models.DiscoveredDataset"]] = rest_field() - """Array of datasets that are part of the asset. Each dataset spec describes the data points that - make up the set.""" - events: Optional[List["_models.DiscoveredEvent"]] = rest_field() - """Array of events that are part of the asset. Each event can have per-event configuration.""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" - - @overload - def __init__( - self, - *, - asset_endpoint_profile_ref: str, - discovery_id: str, - version: int, - 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, - default_datasets_configuration: Optional[str] = None, - default_events_configuration: Optional[str] = None, - default_topic: Optional["_models.Topic"] = None, - datasets: Optional[List["_models.DiscoveredDataset"]] = None, - events: Optional[List["_models.DiscoveredEvent"]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class DiscoveredAssetUpdate(_model_base.Model): - """The type used for update operations of the DiscoveredAsset. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdateProperties - """ - - tags: Optional[Dict[str, str]] = rest_field() - """Resource tags.""" - properties: Optional["_models.DiscoveredAssetUpdateProperties"] = rest_field() - """The resource-specific properties for this resource.""" - - @overload - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.DiscoveredAssetUpdateProperties"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class DiscoveredAssetUpdateProperties(_model_base.Model): - """The updatable properties of the DiscoveredAsset. - - :ivar discovery_id: Identifier used to detect changes in the asset. - :vartype discovery_id: str - :ivar version: An integer that is incremented each time the resource is modified. - :vartype version: int - :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 default_datasets_configuration: Stringified JSON that contains connector-specific default - configuration for all datasets. Each dataset can have its own configuration that overrides the - default settings here. - :vartype default_datasets_configuration: str - :ivar default_events_configuration: Stringified JSON that contains connector-specific default - configuration for all events. Each event can have its own configuration that overrides the - default settings here. - :vartype default_events_configuration: str - :ivar default_topic: Object that describes the default topic information for the asset. - :vartype default_topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar datasets: Array of datasets that are part of the asset. Each dataset spec describes the - data points that make up the set. - :vartype datasets: list[~azure.mgmt.deviceregistry.models.DiscoveredDataset] - :ivar events: Array of events that are part of the asset. Each event can have per-event - configuration. - :vartype events: list[~azure.mgmt.deviceregistry.models.DiscoveredEvent] - """ - - discovery_id: Optional[str] = rest_field(name="discoveryId") - """Identifier used to detect changes in the asset.""" - version: Optional[int] = rest_field() - """An integer that is incremented each time the resource is modified.""" - manufacturer: Optional[str] = rest_field() - """Asset manufacturer name.""" - manufacturer_uri: Optional[str] = rest_field(name="manufacturerUri") - """Asset manufacturer URI.""" - model: Optional[str] = rest_field() - """Asset model name.""" - product_code: Optional[str] = rest_field(name="productCode") - """Asset product code.""" - hardware_revision: Optional[str] = rest_field(name="hardwareRevision") - """Revision number of the hardware.""" - software_revision: Optional[str] = rest_field(name="softwareRevision") - """Revision number of the software.""" - documentation_uri: Optional[str] = rest_field(name="documentationUri") - """Reference to the documentation.""" - serial_number: Optional[str] = rest_field(name="serialNumber") - """Asset serial number.""" - default_datasets_configuration: Optional[str] = rest_field(name="defaultDatasetsConfiguration") - """Stringified JSON that contains connector-specific default configuration for all datasets. Each - dataset can have its own configuration that overrides the default settings here.""" - default_events_configuration: Optional[str] = rest_field(name="defaultEventsConfiguration") - """Stringified JSON that contains connector-specific default configuration for all events. Each - event can have its own configuration that overrides the default settings here.""" - default_topic: Optional["_models.Topic"] = rest_field(name="defaultTopic") - """Object that describes the default topic information for the asset.""" - datasets: Optional[List["_models.DiscoveredDataset"]] = rest_field() - """Array of datasets that are part of the asset. Each dataset spec describes the data points that - make up the set.""" - events: Optional[List["_models.DiscoveredEvent"]] = rest_field() - """Array of events that are part of the asset. Each event can have per-event configuration.""" - - @overload - def __init__( - self, - *, - discovery_id: Optional[str] = None, - version: Optional[int] = 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, - default_datasets_configuration: Optional[str] = None, - default_events_configuration: Optional[str] = None, - default_topic: Optional["_models.Topic"] = None, - datasets: Optional[List["_models.DiscoveredDataset"]] = None, - events: Optional[List["_models.DiscoveredEvent"]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class DiscoveredDataPoint(_model_base.Model): - """Defines the data point properties. - - - :ivar name: The name of the data point. Required. - :vartype name: str - :ivar data_source: The address of the source of the data in the asset (e.g. URL) so that a - client can access the data source on the asset. Required. - :vartype data_source: str - :ivar data_point_configuration: Stringified JSON that contains connector-specific configuration - for the data point. For OPC UA, this could include configuration like, publishingInterval, - samplingInterval, and queueSize. - :vartype data_point_configuration: str - :ivar last_updated_on: UTC timestamp indicating when the data point was added or modified. - :vartype last_updated_on: ~datetime.datetime - """ - - name: str = rest_field() - """The name of the data point. Required.""" - data_source: str = rest_field(name="dataSource") - """The address of the source of the data in the asset (e.g. URL) so that a client can access the - data source on the asset. Required.""" - data_point_configuration: Optional[str] = rest_field(name="dataPointConfiguration") - """Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, - this could include configuration like, publishingInterval, samplingInterval, and queueSize.""" - last_updated_on: Optional[datetime.datetime] = rest_field(name="lastUpdatedOn", format="rfc3339") - """UTC timestamp indicating when the data point was added or modified.""" - - @overload - def __init__( - self, - *, - name: str, - data_source: str, - data_point_configuration: Optional[str] = None, - last_updated_on: Optional[datetime.datetime] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class DiscoveredDataset(_model_base.Model): - """Defines the dataset properties. - - - :ivar name: Name of the dataset. Required. - :vartype name: str - :ivar dataset_configuration: Stringified JSON that contains connector-specific properties that - describes configuration for the specific dataset. - :vartype dataset_configuration: str - :ivar topic: Object that describes the topic information for the specific dataset. - :vartype topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar data_points: Array of data points that are part of the dataset. Each data point can have - per-data point configuration. - :vartype data_points: list[~azure.mgmt.deviceregistry.models.DiscoveredDataPoint] - """ - - name: str = rest_field() - """Name of the dataset. Required.""" - dataset_configuration: Optional[str] = rest_field(name="datasetConfiguration") - """Stringified JSON that contains connector-specific properties that describes configuration for - the specific dataset.""" - topic: Optional["_models.Topic"] = rest_field() - """Object that describes the topic information for the specific dataset.""" - data_points: Optional[List["_models.DiscoveredDataPoint"]] = rest_field(name="dataPoints") - """Array of data points that are part of the dataset. Each data point can have per-data point - configuration.""" - - @overload - def __init__( - self, - *, - name: str, - dataset_configuration: Optional[str] = None, - topic: Optional["_models.Topic"] = None, - data_points: Optional[List["_models.DiscoveredDataPoint"]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class DiscoveredEvent(_model_base.Model): - """Defines the event properties. - - - :ivar name: The name of the event. Required. - :vartype name: str - :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that - a client can access the event on the asset. Required. - :vartype event_notifier: str - :ivar event_configuration: Stringified JSON that contains connector-specific configuration for - the event. For OPC UA, this could include configuration like, publishingInterval, - samplingInterval, and queueSize. - :vartype event_configuration: str - :ivar topic: Object that describes the topic information for the specific event. - :vartype topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar last_updated_on: UTC timestamp indicating when the event was added or modified. - :vartype last_updated_on: ~datetime.datetime - """ - - name: str = rest_field() - """The name of the event. Required.""" - event_notifier: str = rest_field(name="eventNotifier") - """The address of the notifier of the event in the asset (e.g. URL) so that a client can access - the event on the asset. Required.""" - event_configuration: Optional[str] = rest_field(name="eventConfiguration") - """Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this - could include configuration like, publishingInterval, samplingInterval, and queueSize.""" - topic: Optional["_models.Topic"] = rest_field() - """Object that describes the topic information for the specific event.""" - last_updated_on: Optional[datetime.datetime] = rest_field(name="lastUpdatedOn", format="rfc3339") - """UTC timestamp indicating when the event was added or modified.""" - - @overload - def __init__( - self, - *, - name: str, - event_notifier: str, - event_configuration: Optional[str] = None, - topic: Optional["_models.Topic"] = None, - last_updated_on: Optional[datetime.datetime] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class ErrorAdditionalInfo(_model_base.Model): - """The resource management error additional info. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: Optional[str] = rest_field(visibility=["read"]) - """The additional info type.""" - info: Optional[Any] = rest_field(visibility=["read"]) - """The additional info.""" - - -class ErrorDetail(_model_base.Model): - """The error detail. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.deviceregistry.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.deviceregistry.models.ErrorAdditionalInfo] - """ - - code: Optional[str] = rest_field(visibility=["read"]) - """The error code.""" - message: Optional[str] = rest_field(visibility=["read"]) - """The error message.""" - target: Optional[str] = rest_field(visibility=["read"]) - """The error target.""" - details: Optional[List["_models.ErrorDetail"]] = rest_field(visibility=["read"]) - """The error details.""" - additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = rest_field( - name="additionalInfo", visibility=["read"] - ) - """The error additional info.""" - - -class ErrorResponse(_model_base.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. - - :ivar error: The error object. - :vartype error: ~azure.mgmt.deviceregistry.models.ErrorDetail - """ - - error: Optional["_models.ErrorDetail"] = rest_field() - """The error object.""" - - @overload - def __init__( - self, - *, - error: Optional["_models.ErrorDetail"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class EventBase(_model_base.Model): - """Defines the event properties. - - - :ivar name: The name of the event. Required. - :vartype name: str - :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that - a client can access the event on the asset. Required. - :vartype event_notifier: str - :ivar event_configuration: Stringified JSON that contains connector-specific configuration for - the event. For OPC UA, this could include configuration like, publishingInterval, - samplingInterval, and queueSize. - :vartype event_configuration: str - :ivar topic: Object that describes the topic information for the specific event. - :vartype topic: ~azure.mgmt.deviceregistry.models.Topic - """ - - name: str = rest_field() - """The name of the event. Required.""" - event_notifier: str = rest_field(name="eventNotifier") - """The address of the notifier of the event in the asset (e.g. URL) so that a client can access - the event on the asset. Required.""" - event_configuration: Optional[str] = rest_field(name="eventConfiguration") - """Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this - could include configuration like, publishingInterval, samplingInterval, and queueSize.""" - topic: Optional["_models.Topic"] = rest_field() - """Object that describes the topic information for the specific event.""" - - @overload - def __init__( - self, - *, - name: str, - event_notifier: str, - event_configuration: Optional[str] = None, - topic: Optional["_models.Topic"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Event(EventBase): - """Defines the event properties. - - - :ivar name: The name of the event. Required. - :vartype name: str - :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that - a client can access the event on the asset. Required. - :vartype event_notifier: str - :ivar event_configuration: Stringified JSON that contains connector-specific configuration for - the event. For OPC UA, this could include configuration like, publishingInterval, - samplingInterval, and queueSize. - :vartype event_configuration: str - :ivar topic: Object that describes the topic information for the specific event. - :vartype topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar observability_mode: An indication of how the event should be mapped to OpenTelemetry. - Known values are: "None" and "Log". - :vartype observability_mode: str or ~azure.mgmt.deviceregistry.models.EventObservabilityMode - """ - - observability_mode: Optional[Union[str, "_models.EventObservabilityMode"]] = rest_field(name="observabilityMode") - """An indication of how the event should be mapped to OpenTelemetry. Known values are: \"None\" - and \"Log\".""" - - @overload - def __init__( - self, - *, - name: str, - event_notifier: str, - event_configuration: Optional[str] = None, - topic: Optional["_models.Topic"] = None, - observability_mode: Optional[Union[str, "_models.EventObservabilityMode"]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class ExtendedLocation(_model_base.Model): - """The extended location. - - - :ivar type: The extended location type. Required. - :vartype type: str - :ivar name: The extended location name. Required. - :vartype name: str - """ - - type: str = rest_field() - """The extended location type. Required.""" - name: str = rest_field() - """The extended location name. Required.""" - - @overload - def __init__( - self, - *, - type: str, - name: str, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class MessageSchemaReference(_model_base.Model): - """Defines the message schema reference properties. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar schema_registry_namespace: The message schema registry namespace. Required. - :vartype schema_registry_namespace: str - :ivar schema_name: The message schema name. Required. - :vartype schema_name: str - :ivar schema_version: The message schema version. Required. - :vartype schema_version: str - """ - - schema_registry_namespace: str = rest_field(name="schemaRegistryNamespace", visibility=["read"]) - """The message schema registry namespace. Required.""" - schema_name: str = rest_field(name="schemaName", visibility=["read"]) - """The message schema name. Required.""" - schema_version: str = rest_field(name="schemaVersion", visibility=["read"]) - """The message schema version. Required.""" - - -class Operation(_model_base.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for Azure Resource Manager/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.deviceregistry.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". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.deviceregistry.models.Origin - :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions - that are for internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.deviceregistry.models.ActionType - """ - - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - \"Microsoft.Compute/virtualMachines/write\", - \"Microsoft.Compute/virtualMachines/capture/action\".""" - is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) - """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and - \"false\" for Azure Resource Manager/control-plane operations.""" - display: Optional["_models.OperationDisplay"] = rest_field(visibility=["read"]) - """Localized display information for this particular operation.""" - origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and - \"user,system\".""" - action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType") - """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for - internal only APIs. \"Internal\"""" - - @overload - def __init__( - self, - *, - action_type: Optional[Union[str, "_models.ActionType"]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class OperationDisplay(_model_base.Model): - """Localized display information for and operation. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - provider: Optional[str] = rest_field(visibility=["read"]) - """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring - Insights\" or \"Microsoft Compute\".""" - resource: Optional[str] = rest_field(visibility=["read"]) - """The localized friendly name of the resource type related to this operation. E.g. \"Virtual - Machines\" or \"Job Schedule Collections\".""" - operation: Optional[str] = rest_field(visibility=["read"]) - """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create - or Update Virtual Machine\", \"Restart Virtual Machine\".""" - description: Optional[str] = rest_field(visibility=["read"]) - """The short, localized friendly description of the operation; suitable for tool tips and detailed - views.""" - - -class OperationStatusResult(_model_base.Model): - """The current status of an async operation. - - - :ivar id: Fully qualified ID for the async operation. - :vartype id: str - :ivar name: Name of the async operation. - :vartype name: str - :ivar status: Operation status. Required. - :vartype status: str - :ivar percent_complete: Percent of the operation that is complete. - :vartype percent_complete: float - :ivar start_time: The start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the operation. - :vartype end_time: ~datetime.datetime - :ivar operations: The operations list. - :vartype operations: list[~azure.mgmt.deviceregistry.models.OperationStatusResult] - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.deviceregistry.models.ErrorDetail - """ - - id: Optional[str] = rest_field() - """Fully qualified ID for the async operation.""" - name: Optional[str] = rest_field() - """Name of the async operation.""" - status: str = rest_field() - """Operation status. Required.""" - percent_complete: Optional[float] = rest_field(name="percentComplete") - """Percent of the operation that is complete.""" - start_time: Optional[datetime.datetime] = rest_field(name="startTime", format="rfc3339") - """The start time of the operation.""" - end_time: Optional[datetime.datetime] = rest_field(name="endTime", format="rfc3339") - """The end time of the operation.""" - operations: Optional[List["_models.OperationStatusResult"]] = rest_field() - """The operations list.""" - error: Optional["_models.ErrorDetail"] = rest_field() - """If present, details of the operation error.""" - - @overload - def __init__( - self, - *, - status: str, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - percent_complete: Optional[float] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - operations: Optional[List["_models.OperationStatusResult"]] = None, - error: Optional["_models.ErrorDetail"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Schema(ProxyResource): - """Schema definition. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.SchemaProperties - """ - - properties: Optional["_models.SchemaProperties"] = rest_field() - """The resource-specific properties for this resource.""" - - @overload - def __init__( - self, - *, - properties: Optional["_models.SchemaProperties"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class SchemaProperties(_model_base.Model): - """Defines the schema properties. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar uuid: Globally unique, immutable, non-reusable id. - :vartype uuid: str - :ivar display_name: Human-readable display name. - :vartype display_name: str - :ivar description: Human-readable description of the schema. - :vartype description: str - :ivar format: Format of the schema. Required. Known values are: "JsonSchema/draft-07" and - "Delta/1.0". - :vartype format: str or ~azure.mgmt.deviceregistry.models.Format - :ivar schema_type: Type of the schema. Required. "MessageSchema" - :vartype schema_type: str or ~azure.mgmt.deviceregistry.models.SchemaType - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState - :ivar tags: Schema tags. - :vartype tags: dict[str, str] - """ - - uuid: Optional[str] = rest_field(visibility=["read"]) - """Globally unique, immutable, non-reusable id.""" - display_name: Optional[str] = rest_field(name="displayName") - """Human-readable display name.""" - description: Optional[str] = rest_field() - """Human-readable description of the schema.""" - format: Union[str, "_models.Format"] = rest_field(visibility=["read", "create"]) - """Format of the schema. Required. Known values are: \"JsonSchema/draft-07\" and \"Delta/1.0\".""" - schema_type: Union[str, "_models.SchemaType"] = rest_field(name="schemaType", visibility=["read", "create"]) - """Type of the schema. Required. \"MessageSchema\"""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" - tags: Optional[Dict[str, str]] = rest_field() - """Schema tags.""" - - @overload - def __init__( - self, - *, - format: Union[str, "_models.Format"], - schema_type: Union[str, "_models.SchemaType"], - display_name: Optional[str] = None, - description: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class SchemaRegistry(TrackedResource): - """Schema registry definition. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryProperties - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: ~azure.mgmt.deviceregistry.models.SystemAssignedServiceIdentity - """ - - properties: Optional["_models.SchemaRegistryProperties"] = rest_field() - """The resource-specific properties for this resource.""" - identity: Optional["_models.SystemAssignedServiceIdentity"] = rest_field() - """The managed service identities assigned to this resource.""" - - @overload - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.SchemaRegistryProperties"] = None, - identity: Optional["_models.SystemAssignedServiceIdentity"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class SchemaRegistryProperties(_model_base.Model): - """Defines the schema registry properties. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar uuid: Globally unique, immutable, non-reusable id. - :vartype uuid: str - :ivar namespace: Schema registry namespace. Uniquely identifies a schema registry within a - tenant. Required. - :vartype namespace: str - :ivar display_name: Human-readable display name. - :vartype display_name: str - :ivar description: Human-readable description of the schema registry. - :vartype description: str - :ivar storage_account_container_url: The Storage Account's Container URL where schemas will be - stored. Required. - :vartype storage_account_container_url: str - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState - """ - - uuid: Optional[str] = rest_field(visibility=["read"]) - """Globally unique, immutable, non-reusable id.""" - namespace: str = rest_field(visibility=["read", "create"]) - """Schema registry namespace. Uniquely identifies a schema registry within a tenant. Required.""" - display_name: Optional[str] = rest_field(name="displayName") - """Human-readable display name.""" - description: Optional[str] = rest_field() - """Human-readable description of the schema registry.""" - storage_account_container_url: str = rest_field(name="storageAccountContainerUrl", visibility=["read", "create"]) - """The Storage Account's Container URL where schemas will be stored. Required.""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" - - @overload - def __init__( - self, - *, - namespace: str, - storage_account_container_url: str, - display_name: Optional[str] = None, - description: Optional[str] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class SchemaRegistryUpdate(_model_base.Model): - """The type used for update operations of the SchemaRegistry. - - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: ~azure.mgmt.deviceregistry.models.SystemAssignedServiceIdentity - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryUpdateProperties - """ - - identity: Optional["_models.SystemAssignedServiceIdentity"] = rest_field() - """The managed service identities assigned to this resource.""" - tags: Optional[Dict[str, str]] = rest_field() - """Resource tags.""" - properties: Optional["_models.SchemaRegistryUpdateProperties"] = rest_field() - """The resource-specific properties for this resource.""" - - @overload - def __init__( - self, - *, - identity: Optional["_models.SystemAssignedServiceIdentity"] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.SchemaRegistryUpdateProperties"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class SchemaRegistryUpdateProperties(_model_base.Model): - """The updatable properties of the SchemaRegistry. - - :ivar display_name: Human-readable display name. - :vartype display_name: str - :ivar description: Human-readable description of the schema registry. - :vartype description: str + :ivar schema_registry_namespace: The message schema registry namespace. Required. + :vartype schema_registry_namespace: str + :ivar schema_name: The message schema name. Required. + :vartype schema_name: str + :ivar schema_version: The message schema version. Required. + :vartype schema_version: str """ - display_name: Optional[str] = rest_field(name="displayName") - """Human-readable display name.""" - description: Optional[str] = rest_field() - """Human-readable description of the schema registry.""" - - @overload - def __init__( - self, - *, - display_name: Optional[str] = None, - description: Optional[str] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) + schema_registry_namespace: str = rest_field(name="schemaRegistryNamespace", visibility=["read"]) + """The message schema registry namespace. Required.""" + schema_name: str = rest_field(name="schemaName", visibility=["read"]) + """The message schema name. Required.""" + schema_version: str = rest_field(name="schemaVersion", visibility=["read"]) + """The message schema version. Required.""" -class SchemaVersion(ProxyResource): - """Schema version's definition. +class Operation(_model_base.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.SchemaVersionProperties + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.deviceregistry.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". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.deviceregistry.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.deviceregistry.models.ActionType """ - properties: Optional["_models.SchemaVersionProperties"] = rest_field() - """The resource-specific properties for this resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" @overload def __init__( self, *, - properties: Optional["_models.SchemaVersionProperties"] = None, + display: Optional["_models.OperationDisplay"] = None, ) -> None: ... @overload @@ -2486,90 +1440,105 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SchemaVersionProperties(_model_base.Model): - """Defines the schema version properties. +class OperationDisplay(_model_base.Model): + """Localized display information for and operation. Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar uuid: Globally unique, immutable, non-reusable id. - :vartype uuid: str - :ivar description: Human-readable description of the schema. + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. :vartype description: str - :ivar schema_content: Schema content. Required. - :vartype schema_content: str - :ivar hash: Hash of the schema content. - :vartype hash: str - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState """ - uuid: Optional[str] = rest_field(visibility=["read"]) - """Globally unique, immutable, non-reusable id.""" - description: Optional[str] = rest_field() - """Human-readable description of the schema.""" - schema_content: str = rest_field(name="schemaContent", visibility=["read", "create"]) - """Schema content. Required.""" - hash: Optional[str] = rest_field(visibility=["read"]) - """Hash of the schema content.""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" - - @overload - def __init__( - self, - *, - schema_content: str, - description: Optional[str] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" -class SystemAssignedServiceIdentity(_model_base.Model): - """Managed service identity (either system assigned, or none). +class OperationStatusResult(_model_base.Model): + """The current status of an async operation. Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: The type of managed identity assigned to this resource. Required. Known values are: - "None" and "SystemAssigned". - :vartype type: str or ~azure.mgmt.deviceregistry.models.SystemAssignedServiceIdentityType + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: list[~azure.mgmt.deviceregistry.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.deviceregistry.models.ErrorDetail + :ivar resource_id: Fully qualified ID of the resource against which the original async + operation was started. + :vartype resource_id: str """ - principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) - """The service principal ID of the system assigned identity. This property will only be provided - for a system assigned identity.""" - tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) - """The tenant ID of the system assigned identity. This property will only be provided for a system - assigned identity.""" - type: Union[str, "_models.SystemAssignedServiceIdentityType"] = rest_field() - """The type of managed identity assigned to this resource. Required. Known values are: \"None\" - and \"SystemAssigned\".""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Fully qualified ID for the async operation.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the async operation.""" + status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation status. Required.""" + percent_complete: Optional[float] = rest_field( + name="percentComplete", visibility=["read", "create", "update", "delete", "query"] + ) + """Percent of the operation that is complete.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The start time of the operation.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end time of the operation.""" + operations: Optional[List["_models.OperationStatusResult"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The operations list.""" + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """If present, details of the operation error.""" + resource_id: Optional[str] = rest_field(name="resourceId", visibility=["read"]) + """Fully qualified ID of the resource against which the original async operation was started.""" @overload def __init__( self, *, - type: Union[str, "_models.SystemAssignedServiceIdentityType"], + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetail"] = None, ) -> None: ... @overload @@ -2602,19 +1571,29 @@ class SystemData(_model_base.Model): :vartype last_modified_at: ~datetime.datetime """ - created_by: Optional[str] = rest_field(name="createdBy") + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) """The identity that created the resource.""" - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="createdByType") + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that created the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - created_at: Optional[datetime.datetime] = rest_field(name="createdAt", format="rfc3339") + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource creation (UTC).""" - last_modified_by: Optional[str] = rest_field(name="lastModifiedBy") + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) """The identity that last modified the resource.""" - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="lastModifiedByType") + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that last modified the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - last_modified_at: Optional[datetime.datetime] = rest_field(name="lastModifiedAt", format="rfc3339") + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource last modification (UTC).""" @overload @@ -2651,9 +1630,11 @@ class Topic(_model_base.Model): :vartype retain: str or ~azure.mgmt.deviceregistry.models.TopicRetainType """ - path: str = rest_field() + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The topic path for messages published to an MQTT broker. Required.""" - retain: Optional[Union[str, "_models.TopicRetainType"]] = rest_field() + retain: Optional[Union[str, "_models.TopicRetainType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """When set to 'Keep', messages published to an MQTT broker will have the retain flag set. Default: 'Never'. Known values are: \"Keep\" and \"Never\".""" @@ -2686,9 +1667,13 @@ class UsernamePasswordCredentials(_model_base.Model): :vartype password_secret_name: str """ - username_secret_name: str = rest_field(name="usernameSecretName") + username_secret_name: str = rest_field( + name="usernameSecretName", visibility=["read", "create", "update", "delete", "query"] + ) """The name of the secret containing the username. Required.""" - password_secret_name: str = rest_field(name="passwordSecretName") + password_secret_name: str = rest_field( + name="passwordSecretName", visibility=["read", "create", "update", "delete", "query"] + ) """The name of the secret containing the password. Required.""" @overload @@ -2719,7 +1704,9 @@ class X509Credentials(_model_base.Model): :vartype certificate_secret_name: str """ - certificate_secret_name: str = rest_field(name="certificateSecretName") + certificate_secret_name: str = rest_field( + name="certificateSecretName", visibility=["read", "create", "update", "delete", "query"] + ) """The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). Required.""" diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/__init__.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/__init__.py index 04984dadf2ba..763af1696fc5 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/__init__.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/__init__.py @@ -17,11 +17,6 @@ from ._operations import AssetsOperations # type: ignore from ._operations import AssetEndpointProfilesOperations # type: ignore from ._operations import BillingContainersOperations # type: ignore -from ._operations import DiscoveredAssetsOperations # type: ignore -from ._operations import DiscoveredAssetEndpointProfilesOperations # type: ignore -from ._operations import SchemaRegistriesOperations # type: ignore -from ._operations import SchemasOperations # type: ignore -from ._operations import SchemaVersionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -33,11 +28,6 @@ "AssetsOperations", "AssetEndpointProfilesOperations", "BillingContainersOperations", - "DiscoveredAssetsOperations", - "DiscoveredAssetEndpointProfilesOperations", - "SchemaRegistriesOperations", - "SchemasOperations", - "SchemaVersionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 f0c18687834c..2519b9c67207 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -12,6 +12,7 @@ from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -32,8 +33,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Serializer +from .._configuration import DeviceRegistryMgmtClientConfiguration +from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._serialization import Deserializer, Serializer from .._validation import api_version_validation if sys.version_info >= (3, 9): @@ -52,7 +54,7 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,11 +75,11 @@ def build_operation_status_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/locations/{location}/operationStatuses/{operationId}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/locations/{location}/operationStatuses/{operationId}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -101,11 +103,11 @@ def build_assets_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -130,11 +132,11 @@ def build_assets_create_or_replace_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -161,11 +163,11 @@ def build_assets_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -191,11 +193,11 @@ def build_assets_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -219,7 +221,7 @@ def build_assets_list_by_resource_group_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +250,7 @@ def build_assets_list_by_subscription_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,11 +276,11 @@ def build_asset_endpoint_profiles_get_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -303,11 +305,11 @@ def build_asset_endpoint_profiles_create_or_replace_request( # pylint: disable= _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -334,11 +336,11 @@ def build_asset_endpoint_profiles_update_request( # pylint: disable=name-too-lo _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -364,11 +366,11 @@ def build_asset_endpoint_profiles_delete_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -392,11 +394,11 @@ def build_asset_endpoint_profiles_list_by_resource_group_request( # pylint: dis _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -419,7 +421,7 @@ def build_asset_endpoint_profiles_list_by_subscription_request( # pylint: disab _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -445,7 +447,7 @@ def build_billing_containers_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -472,7 +474,7 @@ def build_billing_containers_list_by_subscription_request( # pylint: disable=na _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -492,4599 +494,38 @@ def build_billing_containers_list_by_subscription_request( # pylint: disable=na return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_discovered_assets_get_request( - resource_group_name: str, discovered_asset_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetName": _SERIALIZER.url("discovered_asset_name", discovered_asset_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_assets_create_or_replace_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetName": _SERIALIZER.url("discovered_asset_name", discovered_asset_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_assets_update_request( - resource_group_name: str, discovered_asset_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetName": _SERIALIZER.url("discovered_asset_name", discovered_asset_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_assets_delete_request( - resource_group_name: str, discovered_asset_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetName": _SERIALIZER.url("discovered_asset_name", discovered_asset_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_assets_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_assets_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssets" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_asset_endpoint_profiles_get_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_endpoint_profile_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetEndpointProfileName": _SERIALIZER.url( - "discovered_asset_endpoint_profile_name", discovered_asset_endpoint_profile_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_asset_endpoint_profiles_create_or_replace_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_endpoint_profile_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetEndpointProfileName": _SERIALIZER.url( - "discovered_asset_endpoint_profile_name", discovered_asset_endpoint_profile_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_asset_endpoint_profiles_update_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_endpoint_profile_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetEndpointProfileName": _SERIALIZER.url( - "discovered_asset_endpoint_profile_name", discovered_asset_endpoint_profile_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_asset_endpoint_profiles_delete_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_endpoint_profile_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetEndpointProfileName": _SERIALIZER.url( - "discovered_asset_endpoint_profile_name", discovered_asset_endpoint_profile_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_asset_endpoint_profiles_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_asset_endpoint_profiles_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_registries_get_request( - resource_group_name: str, schema_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_registries_create_or_replace_request( # pylint: disable=name-too-long - resource_group_name: str, schema_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_registries_update_request( - resource_group_name: str, schema_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_registries_delete_request( - resource_group_name: str, schema_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_registries_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_registries_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/schemaRegistries" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schemas_get_request( - resource_group_name: str, schema_registry_name: str, schema_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schemas_create_or_replace_request( - resource_group_name: str, schema_registry_name: str, schema_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schemas_delete_request( - resource_group_name: str, schema_registry_name: str, schema_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schemas_list_by_schema_registry_request( # pylint: disable=name-too-long - resource_group_name: str, schema_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_versions_get_request( - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - "schemaVersionName": _SERIALIZER.url("schema_version_name", schema_version_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_versions_create_or_replace_request( # pylint: disable=name-too-long - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - "schemaVersionName": _SERIALIZER.url("schema_version_name", schema_version_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_versions_delete_request( - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - "schemaVersionName": _SERIALIZER.url("schema_version_name", schema_version_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_versions_list_by_schema_request( # pylint: disable=name-too-long - resource_group_name: str, schema_registry_name: str, schema_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`operations` attribute. - """ - - 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of Operation - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_operations_list_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class OperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`operation_status` attribute. - """ - - 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationStatusResult: - """Returns the current status of an async operation. - - :param location: The location name. Required. - :type location: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :return: OperationStatusResult. The OperationStatusResult is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.OperationStatusResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - - _request = build_operation_status_get_request( - location=location, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.OperationStatusResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class AssetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`assets` attribute. - """ - - 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> _models.Asset: - """Get a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :return: Asset. The Asset is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Asset - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Asset] = kwargs.pop("cls", None) - - _request = build_assets_get_request( - resource_group_name=resource_group_name, - asset_name=asset_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Asset, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _create_or_replace_initial( - self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_assets_create_or_replace_request( - resource_group_name=resource_group_name, - asset_name=asset_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_name: str, - resource: _models.Asset, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Create a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param resource: Resource create parameters. Required. - :type resource: ~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 - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Create a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Create a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_create_or_replace( - self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Create a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param resource: Resource create parameters. Is one of the following types: Asset, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.Asset or JSON or IO[bytes] - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Asset] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_replace_initial( - resource_group_name=resource_group_name, - asset_name=asset_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Asset, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Asset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Asset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _update_initial( - self, - resource_group_name: str, - asset_name: str, - properties: Union[_models.AssetUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_assets_update_request( - resource_group_name=resource_group_name, - asset_name=asset_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: _models.AssetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Update a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :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 - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Update a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Update a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: Union[_models.AssetUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Update a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :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 one of the following types: - AssetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Asset] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - asset_name=asset_name, - properties=properties, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Asset, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Asset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Asset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _delete_initial(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_assets_delete_request( - resource_group_name=resource_group_name, - asset_name=asset_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_delete(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - asset_name=asset_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Asset"]: - """List Asset resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of Asset - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Asset]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_assets_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Asset], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Asset"]: - """List Asset resources by subscription ID. - - :return: An iterator like instance of Asset - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Asset]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_assets_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Asset], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class AssetEndpointProfilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`asset_endpoint_profiles` attribute. - """ - - 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def get( - self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any - ) -> _models.AssetEndpointProfile: - """Get a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :return: AssetEndpointProfile. The AssetEndpointProfile is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.AssetEndpointProfile] = kwargs.pop("cls", None) - - _request = build_asset_endpoint_profiles_get_request( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.AssetEndpointProfile, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _create_or_replace_initial( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: Union[_models.AssetEndpointProfile, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_asset_endpoint_profiles_create_or_replace_request( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: _models.AssetEndpointProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Create a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: ~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 - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Create a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Create a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_create_or_replace( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: Union[_models.AssetEndpointProfile, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Create a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param resource: Resource create parameters. Is one of the following types: - AssetEndpointProfile, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile or JSON or IO[bytes] - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AssetEndpointProfile] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_replace_initial( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.AssetEndpointProfile, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _update_initial( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: Union[_models.AssetEndpointProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_asset_endpoint_profiles_update_request( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: _models.AssetEndpointProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Update a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :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. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Update a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :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. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Update a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :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. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_update( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: Union[_models.AssetEndpointProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Update a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :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 one of the following types: - AssetEndpointProfileUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate or JSON or - IO[bytes] - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AssetEndpointProfile] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_name, - properties=properties, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.AssetEndpointProfile, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _delete_initial( - self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_asset_endpoint_profiles_delete_request( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_delete( - self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.AssetEndpointProfile"]: - """List AssetEndpointProfile resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of AssetEndpointProfile - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.AssetEndpointProfile]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_asset_endpoint_profiles_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AssetEndpointProfile"]: - """List AssetEndpointProfile resources by subscription ID. - - :return: An iterator like instance of AssetEndpointProfile - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.AssetEndpointProfile]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_asset_endpoint_profiles_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class BillingContainersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`billing_containers` attribute. - """ - - 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "billing_container_name", "accept"] - }, - ) - def get(self, billing_container_name: str, **kwargs: Any) -> _models.BillingContainer: - """Get a BillingContainer. - - :param billing_container_name: Name of the billing container. Required. - :type billing_container_name: str - :return: BillingContainer. The BillingContainer is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.BillingContainer - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.BillingContainer] = kwargs.pop("cls", None) - - _request = build_billing_containers_get_request( - billing_container_name=billing_container_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.BillingContainer, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BillingContainer"]: - """List BillingContainer resources by subscription ID. - - :return: An iterator like instance of BillingContainer - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.BillingContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.BillingContainer]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_billing_containers_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.BillingContainer], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class DiscoveredAssetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`discovered_assets` attribute. - """ - - 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - def get(self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any) -> _models.DiscoveredAsset: - """Get a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :return: DiscoveredAsset. The DiscoveredAsset is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.DiscoveredAsset - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.DiscoveredAsset] = kwargs.pop("cls", None) - - _request = build_discovered_assets_get_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DiscoveredAsset, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - def _create_or_replace_initial( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: Union[_models.DiscoveredAsset, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_assets_create_or_replace_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: _models.DiscoveredAsset, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAsset - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: Union[_models.DiscoveredAsset, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Is one of the following types: DiscoveredAsset, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAsset or JSON or IO[bytes] - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiscoveredAsset] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_replace_initial( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DiscoveredAsset, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DiscoveredAsset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiscoveredAsset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - def _update_initial( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: Union[_models.DiscoveredAssetUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_assets_update_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: _models.DiscoveredAssetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: Union[_models.DiscoveredAssetUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DiscoveredAssetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiscoveredAsset] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - properties=properties, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DiscoveredAsset, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DiscoveredAsset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiscoveredAsset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - def _delete_initial(self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_discovered_assets_delete_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - def begin_delete(self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, - ) - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DiscoveredAsset"]: - """List DiscoveredAsset resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiscoveredAsset - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAsset]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_discovered_assets_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAsset], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DiscoveredAsset"]: - """List DiscoveredAsset resources by subscription ID. - - :return: An iterator like instance of DiscoveredAsset - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAsset]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_discovered_assets_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAsset], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class DiscoveredAssetEndpointProfilesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`discovered_asset_endpoint_profiles` attribute. - """ - - 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - def get( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> _models.DiscoveredAssetEndpointProfile: - """Get a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :return: DiscoveredAssetEndpointProfile. The DiscoveredAssetEndpointProfile is compatible with - MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.DiscoveredAssetEndpointProfile] = kwargs.pop("cls", None) - - _request = build_discovered_asset_endpoint_profiles_get_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DiscoveredAssetEndpointProfile, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - def _create_or_replace_initial( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: Union[_models.DiscoveredAssetEndpointProfile, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_asset_endpoint_profiles_create_or_replace_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: _models.DiscoveredAssetEndpointProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: Union[_models.DiscoveredAssetEndpointProfile, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Is one of the following types: - DiscoveredAssetEndpointProfile, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile or JSON or - IO[bytes] - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiscoveredAssetEndpointProfile] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_replace_initial( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DiscoveredAssetEndpointProfile, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DiscoveredAssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiscoveredAssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - def _update_initial( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: Union[_models.DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_asset_endpoint_profiles_update_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: _models.DiscoveredAssetEndpointProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: Union[_models.DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate or - JSON or IO[bytes] - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiscoveredAssetEndpointProfile] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - properties=properties, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DiscoveredAssetEndpointProfile, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DiscoveredAssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiscoveredAssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - def _delete_initial( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_discovered_asset_endpoint_profiles_delete_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - def begin_delete( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s + :attr:`operations` attribute. + """ - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.DiscoveredAssetEndpointProfile"]: - """List DiscoveredAssetEndpointProfile resources by resource group. + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiscoveredAssetEndpointProfile - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DiscoveredAssetEndpointProfile]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5097,9 +538,7 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - _request = build_discovered_asset_endpoint_profiles_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, + _request = build_operations_list_request( api_version=self._config.api_version, headers=_headers, params=_params, @@ -5135,7 +574,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAssetEndpointProfile], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -5151,31 +590,46 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s + :attr:`operation_status` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DiscoveredAssetEndpointProfile"]: - """List DiscoveredAssetEndpointProfile resources by subscription ID. + def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationStatusResult: + """Returns the current status of an async operation. - :return: An iterator like instance of DiscoveredAssetEndpointProfile - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] + :param location: The location name. Required. + :type location: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :return: OperationStatusResult. The OperationStatusResult is compatible with MutableMapping + :rtype: ~azure.mgmt.deviceregistry.models.OperationStatusResult :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAssetEndpointProfile]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5184,111 +638,83 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DiscoveredAss } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_discovered_asset_endpoint_profiles_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - return _request + _request = build_operation_status_get_request( + location=location, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAssetEndpointProfile], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationStatusResult, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore -class SchemaRegistriesOperations: +class AssetsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`schema_registries` attribute. + :attr:`assets` attribute. """ 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any) -> _models.SchemaRegistry: - """Get a SchemaRegistry. + def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> _models.Asset: + """Get a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :return: SchemaRegistry. The SchemaRegistry is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaRegistry + :param asset_name: Asset name parameter. Required. + :type asset_name: str + :return: Asset. The Asset is compatible with MutableMapping + :rtype: ~azure.mgmt.deviceregistry.models.Asset :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5302,11 +728,11 @@ def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SchemaRegistry] = kwargs.pop("cls", None) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) - _request = build_schema_registries_get_request( + _request = build_assets_get_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5331,13 +757,13 @@ def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SchemaRegistry, response.json()) + deserialized = _deserialize(_models.Asset, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5345,25 +771,10 @@ def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any return deserialized # type: ignore @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) def _create_or_replace_initial( - self, - resource_group_name: str, - schema_registry_name: str, - resource: Union[_models.SchemaRegistry, JSON, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5386,9 +797,9 @@ def _create_or_replace_initial( else: _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_schema_registries_create_or_replace_request( + _request = build_assets_create_or_replace_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -5414,7 +825,7 @@ def _create_or_replace_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -5435,27 +846,27 @@ def _create_or_replace_initial( def begin_create_or_replace( self, resource_group_name: str, - schema_registry_name: str, - resource: _models.SchemaRegistry, + asset_name: str, + resource: _models.Asset, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Create a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaRegistry + :type resource: ~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 - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5463,27 +874,27 @@ def begin_create_or_replace( def begin_create_or_replace( self, resource_group_name: str, - schema_registry_name: str, + asset_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Create a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param resource: Resource create parameters. Required. :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5491,79 +902,64 @@ def begin_create_or_replace( def begin_create_or_replace( self, resource_group_name: str, - schema_registry_name: str, + asset_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Create a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param resource: Resource create parameters. Required. :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) def begin_create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: Union[_models.SchemaRegistry, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. + self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.Asset]: + """Create a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Is one of the following types: SchemaRegistry, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaRegistry or JSON or IO[bytes] - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :param asset_name: Asset name parameter. Required. + :type asset_name: str + :param resource: Resource create parameters. Is one of the following types: Asset, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.deviceregistry.models.Asset or JSON or IO[bytes] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SchemaRegistry] = kwargs.pop("cls", None) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_replace_initial( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, resource=resource, content_type=content_type, cls=lambda x, y, z: x, @@ -5576,7 +972,7 @@ def begin_create_or_replace( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SchemaRegistry, response.json()) + deserialized = _deserialize(_models.Asset, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5594,35 +990,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SchemaRegistry].from_continuation_token( + return LROPoller[_models.Asset].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.SchemaRegistry]( + return LROPoller[_models.Asset]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) def _update_initial( self, resource_group_name: str, - schema_registry_name: str, - properties: Union[_models.SchemaRegistryUpdate, JSON, IO[bytes]], + asset_name: str, + properties: Union[_models.AssetUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -5646,9 +1031,9 @@ def _update_initial( else: _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_schema_registries_update_request( + _request = build_assets_update_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -5674,7 +1059,7 @@ def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -5693,27 +1078,27 @@ def _update_initial( def begin_update( self, resource_group_name: str, - schema_registry_name: str, - properties: _models.SchemaRegistryUpdate, + asset_name: str, + properties: _models.AssetUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Update a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :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.SchemaRegistryUpdate + :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5721,27 +1106,27 @@ def begin_update( def begin_update( self, resource_group_name: str, - schema_registry_name: str, + asset_name: str, properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Update a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param properties: The resource properties to be updated. Required. :type properties: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5749,79 +1134,68 @@ def begin_update( def begin_update( self, resource_group_name: str, - schema_registry_name: str, + asset_name: str, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Update a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param properties: The resource properties to be updated. Required. :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) def begin_update( self, resource_group_name: str, - schema_registry_name: str, - properties: Union[_models.SchemaRegistryUpdate, JSON, IO[bytes]], + asset_name: str, + properties: Union[_models.AssetUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Update a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param properties: The resource properties to be updated. Is one of the following types: - SchemaRegistryUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + AssetUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SchemaRegistry] = kwargs.pop("cls", None) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, properties=properties, content_type=content_type, cls=lambda x, y, z: x, @@ -5834,7 +1208,7 @@ def begin_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SchemaRegistry, response.json()) + deserialized = _deserialize(_models.Asset, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5852,30 +1226,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SchemaRegistry].from_continuation_token( + return LROPoller[_models.Asset].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.SchemaRegistry]( + return LROPoller[_models.Asset]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def _delete_initial(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any) -> Iterator[bytes]: + def _delete_initial(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5889,9 +1253,9 @@ def _delete_initial(self, resource_group_name: str, schema_registry_name: str, * cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_schema_registries_delete_request( + _request = build_assets_delete_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5915,7 +1279,7 @@ def _delete_initial(self, resource_group_name: str, schema_registry_name: str, * except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -5932,26 +1296,16 @@ def _delete_initial(self, resource_group_name: str, schema_registry_name: str, * @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def begin_delete(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a SchemaRegistry. + def begin_delete(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -5966,7 +1320,7 @@ def begin_delete(self, resource_group_name: str, schema_registry_name: str, **kw if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -6002,25 +1356,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SchemaRegistry"]: - """List SchemaRegistry resources by resource group. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Asset"]: + """List Asset resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of SchemaRegistry - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An iterator like instance of Asset + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SchemaRegistry]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Asset]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6033,7 +1384,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - _request = build_schema_registries_list_by_resource_group_request( + _request = build_assets_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, @@ -6071,7 +1422,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SchemaRegistry], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Asset], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6087,7 +1438,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -6096,20 +1447,19 @@ def get_next(next_link=None): @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SchemaRegistry"]: - """List SchemaRegistry resources by subscription ID. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Asset"]: + """List Asset resources by subscription ID. - :return: An iterator like instance of SchemaRegistry - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An iterator like instance of Asset + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SchemaRegistry]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Asset]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6122,7 +1472,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SchemaRegistr def prepare_request(next_link=None): if not next_link: - _request = build_schema_registries_list_by_subscription_request( + _request = build_assets_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6159,7 +1509,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SchemaRegistry], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Asset], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6167,70 +1517,358 @@ def extract_data(pipeline_response): def get_next(next_link=None): _request = prepare_request(next_link) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class AssetEndpointProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s + :attr:`asset_endpoint_profiles` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def get( + self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any + ) -> _models.AssetEndpointProfile: + """Get a AssetEndpointProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :return: AssetEndpointProfile. The AssetEndpointProfile is compatible with MutableMapping + :rtype: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AssetEndpointProfile] = kwargs.pop("cls", None) + + _request = build_asset_endpoint_profiles_get_request( + resource_group_name=resource_group_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AssetEndpointProfile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def _create_or_replace_initial( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: Union[_models.AssetEndpointProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_asset_endpoint_profiles_create_or_replace_request( + resource_group_name=resource_group_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") ) - response = pipeline_response.http_response + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore + @overload + def begin_create_or_replace( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: _models.AssetEndpointProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssetEndpointProfile]: + """Create a AssetEndpointProfile. -class SchemasOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: ~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 + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`schemas` attribute. - """ + @overload + def begin_create_or_replace( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssetEndpointProfile]: + """Create a AssetEndpointProfile. - 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") + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_replace( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssetEndpointProfile]: + """Create a AssetEndpointProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def get( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> _models.Schema: - """Get a Schema. + def begin_create_or_replace( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: Union[_models.AssetEndpointProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AssetEndpointProfile]: + """Create a AssetEndpointProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param resource: Resource create parameters. Is one of the following types: + AssetEndpointProfile, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile or JSON or IO[bytes] + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetEndpointProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_replace_initial( + resource_group_name=resource_group_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AssetEndpointProfile, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AssetEndpointProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AssetEndpointProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def _update_initial( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + properties: Union[_models.AssetEndpointProfileUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6239,17 +1877,26 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Schema] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_schemas_get_request( + _request = build_asset_endpoint_profiles_update_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6258,163 +1905,203 @@ def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Schema, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def create_or_replace( + def begin_update( self, resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: _models.Schema, + asset_endpoint_profile_name: str, + properties: _models.AssetEndpointProfileUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schema: - """Create a Schema. + ) -> LROPoller[_models.AssetEndpointProfile]: + """Update a AssetEndpointProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.Schema + :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 :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_replace( + def begin_update( self, resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: JSON, + asset_endpoint_profile_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schema: - """Create a Schema. + ) -> LROPoller[_models.AssetEndpointProfile]: + """Update a AssetEndpointProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON + :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: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_replace( + def begin_update( self, resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: IO[bytes], + asset_endpoint_profile_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schema: - """Create a Schema. + ) -> LROPoller[_models.AssetEndpointProfile]: + """Update a AssetEndpointProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] + :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: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def create_or_replace( + def begin_update( self, resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: Union[_models.Schema, JSON, IO[bytes]], + asset_endpoint_profile_name: str, + properties: Union[_models.AssetEndpointProfileUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Schema: - """Create a Schema. + ) -> LROPoller[_models.AssetEndpointProfile]: + """Update a AssetEndpointProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Is one of the following types: Schema, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.Schema or JSON or IO[bytes] - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema + :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 one of the following types: + AssetEndpointProfileUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetEndpointProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AssetEndpointProfile, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AssetEndpointProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AssetEndpointProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def _delete_initial( + self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6423,27 +2110,16 @@ def create_or_replace( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Schema] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_schemas_create_or_replace_request( + _request = build_asset_endpoint_profiles_delete_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6452,64 +2128,117 @@ def create_or_replace( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Schema, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def begin_delete( + self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a AssetEndpointProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> None: - """Delete a Schema. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.AssetEndpointProfile"]: + """List AssetEndpointProfile resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: None - :rtype: None + :return: An iterator like instance of AssetEndpointProfile + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AssetEndpointProfile]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6518,72 +2247,85 @@ def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[None] = kwargs.pop("cls", None) + _request = build_asset_endpoint_profiles_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_schemas_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_schema_registry( - self, resource_group_name: str, schema_registry_name: str, **kwargs: Any - ) -> Iterable["_models.Schema"]: - """List Schema resources by SchemaRegistry. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AssetEndpointProfile"]: + """List AssetEndpointProfile resources by subscription ID. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :return: An iterator like instance of Schema - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Schema] + :return: An iterator like instance of AssetEndpointProfile + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Schema]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.AssetEndpointProfile]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6596,9 +2338,7 @@ def list_by_schema_registry( def prepare_request(next_link=None): if not next_link: - _request = build_schemas_list_by_schema_registry_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + _request = build_asset_endpoint_profiles_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6635,7 +2375,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Schema], deserialized["value"]) + list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6651,7 +2391,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -6659,60 +2399,37 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class SchemaVersionsOperations: +class BillingContainersOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`schema_versions` attribute. + :attr:`billing_containers` attribute. """ 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace @api_version_validation( method_added_on="2024-09-01-preview", params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "accept", - ] + "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "billing_container_name", "accept"] }, ) - def get( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - **kwargs: Any - ) -> _models.SchemaVersion: - """Get a SchemaVersion. + def get(self, billing_container_name: str, **kwargs: Any) -> _models.BillingContainer: + """Get a BillingContainer. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion + :param billing_container_name: Name of the billing container. Required. + :type billing_container_name: str + :return: BillingContainer. The BillingContainer is compatible with MutableMapping + :rtype: ~azure.mgmt.deviceregistry.models.BillingContainer :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6726,13 +2443,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SchemaVersion] = kwargs.pop("cls", None) + cls: ClsType[_models.BillingContainer] = kwargs.pop("cls", None) - _request = build_schema_versions_get_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_name, + _request = build_billing_containers_get_request( + billing_container_name=billing_container_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6757,221 +2471,13 @@ def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SchemaVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: _models.SchemaVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "content_type", - "accept", - ] - }, - ) - def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: Union[_models.SchemaVersion, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Is one of the following types: SchemaVersion, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaVersion or JSON or IO[bytes] - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SchemaVersion] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schema_versions_create_or_replace_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SchemaVersion, response.json()) + deserialized = _deserialize(_models.BillingContainer, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6981,120 +2487,19 @@ def create_or_replace( @distributed_trace @api_version_validation( method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "accept", - ] - }, - ) - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - **kwargs: Any - ) -> None: - """Delete a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_schema_versions_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, ) - def list_by_schema( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> Iterable["_models.SchemaVersion"]: - """List SchemaVersion resources by Schema. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BillingContainer"]: + """List BillingContainer resources by subscription ID. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: An iterator like instance of SchemaVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.SchemaVersion] + :return: An iterator like instance of BillingContainer + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.BillingContainer] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SchemaVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.BillingContainer]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7107,10 +2512,7 @@ def list_by_schema( def prepare_request(next_link=None): if not next_link: - _request = build_schema_versions_list_by_schema_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, + _request = build_billing_containers_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7147,7 +2549,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SchemaVersion], deserialized["value"]) + list_of_elem = _deserialize(List[_models.BillingContainer], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -7163,7 +2565,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile.py index 8e997d5f28f8..cd536bc40680 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -50,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile.json +# x-ms-original-file: 2024-11-01/Create_AssetEndpointProfile.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile_with_discovered_aep_ref.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile_with_discovered_aep_ref.py index 73b1bb92ebdc..096971ef690a 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile_with_discovered_aep_ref.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile_with_discovered_aep_ref.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -51,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile_With_DiscoveredAepRef.json +# x-ms-original-file: 2024-11-01/Create_AssetEndpointProfile_With_DiscoveredAepRef.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_discovered_asset_ref.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_discovered_asset_ref.py index 6ced5b8cfebc..05b46471e2f8 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_discovered_asset_ref.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_discovered_asset_ref.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -100,6 +101,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_Asset_With_DiscoveredAssetRef.json +# x-ms-original-file: 2024-11-01/Create_Asset_With_DiscoveredAssetRef.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_external_asset_id.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_external_asset_id.py index 1b3e94e3893d..7c39310ea58b 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_external_asset_id.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_external_asset_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -99,6 +100,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_Asset_With_ExternalAssetId.json +# x-ms-original-file: 2024-11-01/Create_Asset_With_ExternalAssetId.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_display_name.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_display_name.py index 79454a657d2c..e853f7f9a9e0 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_display_name.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_display_name.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -98,6 +99,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_DisplayName.json +# x-ms-original-file: 2024-11-01/Create_Asset_Without_DisplayName.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_external_asset_id.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_external_asset_id.py index 64984dceb386..add2f1edb9ec 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_external_asset_id.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_external_asset_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -98,6 +99,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_ExternalAssetId.json +# x-ms-original-file: 2024-11-01/Create_Asset_Without_ExternalAssetId.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset.py deleted file mode 100644 index b3daa8e4809c..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_discovered_asset.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.begin_create_or_replace( - resource_group_name="myResourceGroup", - discovered_asset_name="my-discoveredasset", - resource={ - "extendedLocation": { - "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", - "type": "CustomLocation", - }, - "location": "West Europe", - "properties": { - "assetEndpointProfileRef": "myAssetEndpointProfile", - "datasets": [ - { - "dataPoints": [ - { - "dataPointConfiguration": '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - "dataSource": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - "name": "dataPoint1", - }, - { - "dataPointConfiguration": '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - "dataSource": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - "name": "dataPoint2", - }, - ], - "datasetConfiguration": '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - "name": "dataset1", - "topic": {"path": "/path/dataset1", "retain": "Keep"}, - } - ], - "defaultDatasetsConfiguration": '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - "defaultEventsConfiguration": '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - "defaultTopic": {"path": "/path/defaultTopic", "retain": "Keep"}, - "discoveryId": "11111111-1111-1111-1111-111111111111", - "documentationUri": "https://www.example.com/manual", - "events": [ - { - "eventConfiguration": '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', - "eventNotifier": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - "name": "event1", - "topic": {"path": "/path/event1", "retain": "Keep"}, - }, - { - "eventConfiguration": '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', - "eventNotifier": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - "name": "event2", - }, - ], - "hardwareRevision": "1.0", - "manufacturer": "Contoso", - "manufacturerUri": "https://www.contoso.com/manufacturerUri", - "model": "ContosoModel", - "productCode": "SA34VDG", - "serialNumber": "64-103816-519918-8", - "softwareRevision": "2.0", - "version": 73766, - }, - "tags": {"site": "building-1"}, - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAsset.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset_endpoint_profile.py deleted file mode 100644 index 35f2c2c60d19..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset_endpoint_profile.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_discovered_asset_endpoint_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.begin_create_or_replace( - resource_group_name="myResourceGroup", - discovered_asset_endpoint_profile_name="my-discoveredassetendpointprofile", - resource={ - "extendedLocation": { - "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", - "type": "CustomLocation", - }, - "location": "West Europe", - "properties": { - "additionalConfiguration": '{"foo": "bar"}', - "discoveryId": "11111111-1111-1111-1111-111111111111", - "endpointProfileType": "myEndpointProfileType", - "supportedAuthenticationMethods": ["Anonymous", "Certificate", "UsernamePassword"], - "targetAddress": "https://www.example.com/myTargetAddress", - "version": 73766, - }, - "tags": {"site": "building-1"}, - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema.py deleted file mode 100644 index 6fa73bce1cf0..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_schema.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schemas.create_or_replace( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - resource={ - "properties": { - "description": "This is a sample Schema", - "displayName": "My Schema", - "format": "JsonSchema/draft-07", - "schemaType": "MessageSchema", - "tags": {"sampleKey": "sampleValue"}, - } - }, - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_Schema.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_registry.py deleted file mode 100644 index 7a876713aa40..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_registry.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.begin_create_or_replace( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - resource={ - "identity": {"type": "None"}, - "location": "West Europe", - "properties": { - "description": "This is a sample Schema Registry", - "displayName": "Schema Registry namespace 001", - "namespace": "sr-namespace-001", - "storageAccountContainerUrl": "my-blob-storage.blob.core.windows.net/my-container", - }, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_SchemaRegistry.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_version.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_version.py deleted file mode 100644 index 97eefbcd1798..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_version.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_schema_version.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_versions.create_or_replace( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - schema_version_name="1", - resource={ - "properties": { - "description": "Schema version 1", - "schemaContent": '{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","properties": {"humidity": {"type": "string"},"temperature": {"type":"number"}}}', - } - }, - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_SchemaVersion.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset.py index 89de078084ae..226ed5d5dd50 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2024-09-01-preview/Delete_Asset.json +# x-ms-original-file: 2024-11-01/Delete_Asset.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset_endpoint_profile.py index 266c63519788..61a9fed33faa 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset_endpoint_profile.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset_endpoint_profile.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2024-09-01-preview/Delete_AssetEndpointProfile.json +# x-ms-original-file: 2024-11-01/Delete_AssetEndpointProfile.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset.py deleted file mode 100644 index 9bf7988d729f..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_discovered_asset.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.discovered_assets.begin_delete( - resource_group_name="myResourceGroup", - discovered_asset_name="my-discoveredasset", - ).result() - - -# x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAsset.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset_endpoint_profile.py deleted file mode 100644 index 830a41ad1f79..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset_endpoint_profile.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_discovered_asset_endpoint_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.discovered_asset_endpoint_profiles.begin_delete( - resource_group_name="myResourceGroup", - discovered_asset_endpoint_profile_name="my-discoveredassetendpointprofile", - ).result() - - -# x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema.py deleted file mode 100644 index 6762c7a7d5c0..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_schema.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.schemas.delete( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - ) - - -# x-ms-original-file: 2024-09-01-preview/Delete_Schema.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_registry.py deleted file mode 100644 index fc6dbff56ecd..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_registry.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.schema_registries.begin_delete( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - ).result() - - -# x-ms-original-file: 2024-09-01-preview/Delete_SchemaRegistry.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_version.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_version.py deleted file mode 100644 index 8c3046cd420f..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_version.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_schema_version.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.schema_versions.delete( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - schema_version_name="1", - ) - - -# x-ms-original-file: 2024-09-01-preview/Delete_SchemaVersion.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset.py index 0b9136e1a8df..d64b7dd5b1b0 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_Asset.json +# x-ms-original-file: 2024-11-01/Get_Asset.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile.py index 4ebf469432a0..38fe07d038e4 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile.json +# x-ms-original-file: 2024-11-01/Get_AssetEndpointProfile.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile_with_sync_status.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile_with_sync_status.py index 663872bdaa0c..5a259fb19e4c 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile_with_sync_status.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile_with_sync_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json +# x-ms-original-file: 2024-11-01/Get_AssetEndpointProfile_With_SyncStatus.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_with_sync_status.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_with_sync_status.py index 0524f35eb198..2b50d28fb2b5 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_with_sync_status.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_with_sync_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_Asset_With_SyncStatus.json +# x-ms-original-file: 2024-11-01/Get_Asset_With_SyncStatus.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_billing_container.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_billing_container.py index f49134c5b010..235cb9580e56 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_billing_container.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_billing_container.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_BillingContainer.json +# x-ms-original-file: 2024-11-01/Get_BillingContainer.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset.py deleted file mode 100644 index 6ea7fb7f37fc..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_discovered_asset.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.get( - resource_group_name="myResourceGroup", - discovered_asset_name="my-discoveredasset", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAsset.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset_endpoint_profile.py deleted file mode 100644 index 32995e4920ea..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset_endpoint_profile.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_discovered_asset_endpoint_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.get( - resource_group_name="myResourceGroup", - discovered_asset_endpoint_profile_name="my-discoveredassetendpointprofile", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_operation_status.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_operation_status.py index 610f0ab6adb3..ebe33643297e 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_operation_status.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_operation_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_OperationStatus.json +# x-ms-original-file: 2024-11-01/Get_OperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema.py deleted file mode 100644 index 720e675cae10..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_schema.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schemas.get( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_Schema.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_registry.py deleted file mode 100644 index 1c74e95654d9..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_registry.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.get( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_SchemaRegistry.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_version.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_version.py deleted file mode 100644 index c387988112d0..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_version.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_schema_version.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_versions.get( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - schema_version_name="1", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_SchemaVersion.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_resource_group.py index 37342fb70f5c..0f3233036ceb 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_resource_group.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json +# x-ms-original-file: 2024-11-01/List_AssetEndpointProfiles_ResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_subscription.py index 22ba2dcbd851..0f48246cb58f 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_subscription.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json +# x-ms-original-file: 2024-11-01/List_AssetEndpointProfiles_Subscription.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_resource_group.py index 64bbd1af7910..74598afe0b00 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_resource_group.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_Assets_ResourceGroup.json +# x-ms-original-file: 2024-11-01/List_Assets_ResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_subscription.py index cdf353af38d8..b7ebd2695219 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_subscription.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_Assets_Subscription.json +# x-ms-original-file: 2024-11-01/List_Assets_Subscription.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_billing_containers_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_billing_containers_subscription.py index fd31e546f0b3..e05233bb4fd3 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_billing_containers_subscription.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_billing_containers_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_BillingContainers_Subscription.json +# x-ms-original-file: 2024-11-01/List_BillingContainers_Subscription.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_resource_group.py deleted file mode 100644 index 54a65475422c..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_resource_group.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_discovered_asset_endpoint_profiles_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_subscription.py deleted file mode 100644 index 44b48e92e609..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_subscription.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_discovered_asset_endpoint_profiles_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_resource_group.py deleted file mode 100644 index cb866097e238..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_resource_group.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_discovered_assets_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_subscription.py deleted file mode 100644 index 238b4ef5569c..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_subscription.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_discovered_assets_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_operations.py index da0625579391..583662f0e2bf 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_operations.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_Operations.json +# x-ms-original-file: 2024-11-01/List_Operations.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_resource_group.py deleted file mode 100644 index f53ad566412d..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_resource_group.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_schema_registries_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_subscription.py deleted file mode 100644 index fada853a4b75..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_subscription.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_schema_registries_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_Subscription.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_versions_schema.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_versions_schema.py deleted file mode 100644 index f68ba34b3aa0..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_versions_schema.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_schema_versions_schema.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_versions.list_by_schema( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_SchemaVersions_Schema.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schemas_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schemas_schema_registry.py deleted file mode 100644 index 59b990ffbd32..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schemas_schema_registry.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_schemas_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schemas.list_by_schema_registry( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_Schemas_SchemaRegistry.json -if __name__ == "__main__": - main() 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 ef72d641ef7c..432d4d619731 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Update_Asset.json +# x-ms-original-file: 2024-11-01/Update_Asset.json if __name__ == "__main__": main() 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 102c5e07e2d5..be32b0cc1635 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Update_AssetEndpointProfile.json +# x-ms-original-file: 2024-11-01/Update_AssetEndpointProfile.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset.py deleted file mode 100644 index 4f53e66130ce..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python update_discovered_asset.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.begin_update( - resource_group_name="myResourceGroup", - discovered_asset_name="my-discoveredasset", - properties={ - "properties": { - "defaultTopic": {"path": "/path/defaultTopic", "retain": "Never"}, - "documentationUri": "https://www.example.com/manual-2", - } - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAsset.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset_endpoint_profile.py deleted file mode 100644 index b4b43033f27b..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset_endpoint_profile.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python update_discovered_asset_endpoint_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.begin_update( - resource_group_name="myResourceGroup", - discovered_asset_endpoint_profile_name="my-discoveredassetendpointprofile", - properties={ - "properties": { - "additionalConfiguration": '{"foo": "bar"}', - "discoveryId": "11111111-1111-1111-1111-111111111111", - "endpointProfileType": "myEndpointProfileType", - "supportedAuthenticationMethods": ["Anonymous", "Certificate"], - "targetAddress": "https://www.example.com/myTargetAddress", - "version": 73766, - } - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_schema_registry.py deleted file mode 100644 index 2f7b7b11bc6b..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_schema_registry.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python update_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.begin_update( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - properties={ - "properties": { - "description": "This is a sample Schema Registry", - "displayName": "Schema Registry namespace 001", - }, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Update_SchemaRegistry.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations.py deleted file mode 100644 index 8f24b8dd96bb..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtDiscoveredAssetEndpointProfilesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_asset_endpoint_profiles_get(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.get( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_asset_endpoint_profiles_begin_create_or_replace(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.begin_create_or_replace( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - resource={ - "extendedLocation": {"name": "str", "type": "str"}, - "location": "str", - "id": "str", - "name": "str", - "properties": { - "discoveryId": "str", - "endpointProfileType": "str", - "targetAddress": "str", - "version": 0, - "additionalConfiguration": "str", - "provisioningState": "str", - "supportedAuthenticationMethods": ["str"], - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_asset_endpoint_profiles_begin_update(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.begin_update( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - properties={ - "properties": { - "additionalConfiguration": "str", - "discoveryId": "str", - "endpointProfileType": "str", - "supportedAuthenticationMethods": ["str"], - "targetAddress": "str", - "version": 0, - }, - "tags": {"str": "str"}, - }, - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_asset_endpoint_profiles_begin_delete(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.begin_delete( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_asset_endpoint_profiles_list_by_resource_group(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.list_by_resource_group( - resource_group_name=resource_group.name, - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_asset_endpoint_profiles_list_by_subscription(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.list_by_subscription() - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations_async.py deleted file mode 100644 index b0ebb3c3599c..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations_async.py +++ /dev/null @@ -1,124 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtDiscoveredAssetEndpointProfilesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_asset_endpoint_profiles_get(self, resource_group): - response = await self.client.discovered_asset_endpoint_profiles.get( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_asset_endpoint_profiles_begin_create_or_replace(self, resource_group): - response = await ( - await self.client.discovered_asset_endpoint_profiles.begin_create_or_replace( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - resource={ - "extendedLocation": {"name": "str", "type": "str"}, - "location": "str", - "id": "str", - "name": "str", - "properties": { - "discoveryId": "str", - "endpointProfileType": "str", - "targetAddress": "str", - "version": 0, - "additionalConfiguration": "str", - "provisioningState": "str", - "supportedAuthenticationMethods": ["str"], - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_asset_endpoint_profiles_begin_update(self, resource_group): - response = await ( - await self.client.discovered_asset_endpoint_profiles.begin_update( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - properties={ - "properties": { - "additionalConfiguration": "str", - "discoveryId": "str", - "endpointProfileType": "str", - "supportedAuthenticationMethods": ["str"], - "targetAddress": "str", - "version": 0, - }, - "tags": {"str": "str"}, - }, - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_asset_endpoint_profiles_begin_delete(self, resource_group): - response = await ( - await self.client.discovered_asset_endpoint_profiles.begin_delete( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_asset_endpoint_profiles_list_by_resource_group(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.list_by_resource_group( - resource_group_name=resource_group.name, - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_asset_endpoint_profiles_list_by_subscription(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.list_by_subscription() - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations.py deleted file mode 100644 index 3a9cb74a552d..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations.py +++ /dev/null @@ -1,180 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtDiscoveredAssetsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_assets_get(self, resource_group): - response = self.client.discovered_assets.get( - resource_group_name=resource_group.name, - discovered_asset_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_assets_begin_create_or_replace(self, resource_group): - response = self.client.discovered_assets.begin_create_or_replace( - resource_group_name=resource_group.name, - discovered_asset_name="str", - resource={ - "extendedLocation": {"name": "str", "type": "str"}, - "location": "str", - "id": "str", - "name": "str", - "properties": { - "assetEndpointProfileRef": "str", - "discoveryId": "str", - "version": 0, - "datasets": [ - { - "name": "str", - "dataPoints": [ - { - "dataSource": "str", - "name": "str", - "dataPointConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - } - ], - "datasetConfiguration": "str", - "topic": {"path": "str", "retain": "str"}, - } - ], - "defaultDatasetsConfiguration": "str", - "defaultEventsConfiguration": "str", - "defaultTopic": {"path": "str", "retain": "str"}, - "documentationUri": "str", - "events": [ - { - "eventNotifier": "str", - "name": "str", - "eventConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - "topic": {"path": "str", "retain": "str"}, - } - ], - "hardwareRevision": "str", - "manufacturer": "str", - "manufacturerUri": "str", - "model": "str", - "productCode": "str", - "provisioningState": "str", - "serialNumber": "str", - "softwareRevision": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_assets_begin_update(self, resource_group): - response = self.client.discovered_assets.begin_update( - resource_group_name=resource_group.name, - discovered_asset_name="str", - properties={ - "properties": { - "datasets": [ - { - "name": "str", - "dataPoints": [ - { - "dataSource": "str", - "name": "str", - "dataPointConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - } - ], - "datasetConfiguration": "str", - "topic": {"path": "str", "retain": "str"}, - } - ], - "defaultDatasetsConfiguration": "str", - "defaultEventsConfiguration": "str", - "defaultTopic": {"path": "str", "retain": "str"}, - "discoveryId": "str", - "documentationUri": "str", - "events": [ - { - "eventNotifier": "str", - "name": "str", - "eventConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - "topic": {"path": "str", "retain": "str"}, - } - ], - "hardwareRevision": "str", - "manufacturer": "str", - "manufacturerUri": "str", - "model": "str", - "productCode": "str", - "serialNumber": "str", - "softwareRevision": "str", - "version": 0, - }, - "tags": {"str": "str"}, - }, - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_assets_begin_delete(self, resource_group): - response = self.client.discovered_assets.begin_delete( - resource_group_name=resource_group.name, - discovered_asset_name="str", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_assets_list_by_resource_group(self, resource_group): - response = self.client.discovered_assets.list_by_resource_group( - resource_group_name=resource_group.name, - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_assets_list_by_subscription(self, resource_group): - response = self.client.discovered_assets.list_by_subscription() - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations_async.py deleted file mode 100644 index 45e7d48e8639..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations_async.py +++ /dev/null @@ -1,187 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtDiscoveredAssetsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_assets_get(self, resource_group): - response = await self.client.discovered_assets.get( - resource_group_name=resource_group.name, - discovered_asset_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_assets_begin_create_or_replace(self, resource_group): - response = await ( - await self.client.discovered_assets.begin_create_or_replace( - resource_group_name=resource_group.name, - discovered_asset_name="str", - resource={ - "extendedLocation": {"name": "str", "type": "str"}, - "location": "str", - "id": "str", - "name": "str", - "properties": { - "assetEndpointProfileRef": "str", - "discoveryId": "str", - "version": 0, - "datasets": [ - { - "name": "str", - "dataPoints": [ - { - "dataSource": "str", - "name": "str", - "dataPointConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - } - ], - "datasetConfiguration": "str", - "topic": {"path": "str", "retain": "str"}, - } - ], - "defaultDatasetsConfiguration": "str", - "defaultEventsConfiguration": "str", - "defaultTopic": {"path": "str", "retain": "str"}, - "documentationUri": "str", - "events": [ - { - "eventNotifier": "str", - "name": "str", - "eventConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - "topic": {"path": "str", "retain": "str"}, - } - ], - "hardwareRevision": "str", - "manufacturer": "str", - "manufacturerUri": "str", - "model": "str", - "productCode": "str", - "provisioningState": "str", - "serialNumber": "str", - "softwareRevision": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_assets_begin_update(self, resource_group): - response = await ( - await self.client.discovered_assets.begin_update( - resource_group_name=resource_group.name, - discovered_asset_name="str", - properties={ - "properties": { - "datasets": [ - { - "name": "str", - "dataPoints": [ - { - "dataSource": "str", - "name": "str", - "dataPointConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - } - ], - "datasetConfiguration": "str", - "topic": {"path": "str", "retain": "str"}, - } - ], - "defaultDatasetsConfiguration": "str", - "defaultEventsConfiguration": "str", - "defaultTopic": {"path": "str", "retain": "str"}, - "discoveryId": "str", - "documentationUri": "str", - "events": [ - { - "eventNotifier": "str", - "name": "str", - "eventConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - "topic": {"path": "str", "retain": "str"}, - } - ], - "hardwareRevision": "str", - "manufacturer": "str", - "manufacturerUri": "str", - "model": "str", - "productCode": "str", - "serialNumber": "str", - "softwareRevision": "str", - "version": 0, - }, - "tags": {"str": "str"}, - }, - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_assets_begin_delete(self, resource_group): - response = await ( - await self.client.discovered_assets.begin_delete( - resource_group_name=resource_group.name, - discovered_asset_name="str", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_assets_list_by_resource_group(self, resource_group): - response = self.client.discovered_assets.list_by_resource_group( - resource_group_name=resource_group.name, - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_assets_list_by_subscription(self, resource_group): - response = self.client.discovered_assets.list_by_subscription() - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations.py deleted file mode 100644 index 5ac65283510d..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemaRegistriesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_registries_get(self, resource_group): - response = self.client.schema_registries.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_registries_begin_create_or_replace(self, resource_group): - response = self.client.schema_registries.begin_create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - resource={ - "location": "str", - "id": "str", - "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, - "name": "str", - "properties": { - "namespace": "str", - "storageAccountContainerUrl": "str", - "description": "str", - "displayName": "str", - "provisioningState": "str", - "uuid": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_registries_begin_update(self, resource_group): - response = self.client.schema_registries.begin_update( - resource_group_name=resource_group.name, - schema_registry_name="str", - properties={ - "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, - "properties": {"description": "str", "displayName": "str"}, - "tags": {"str": "str"}, - }, - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_registries_begin_delete(self, resource_group): - response = self.client.schema_registries.begin_delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_registries_list_by_resource_group(self, resource_group): - response = self.client.schema_registries.list_by_resource_group( - resource_group_name=resource_group.name, - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_registries_list_by_subscription(self, resource_group): - response = self.client.schema_registries.list_by_subscription() - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations_async.py deleted file mode 100644 index 1ea2592f92d0..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations_async.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemaRegistriesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_registries_get(self, resource_group): - response = await self.client.schema_registries.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_registries_begin_create_or_replace(self, resource_group): - response = await ( - await self.client.schema_registries.begin_create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - resource={ - "location": "str", - "id": "str", - "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, - "name": "str", - "properties": { - "namespace": "str", - "storageAccountContainerUrl": "str", - "description": "str", - "displayName": "str", - "provisioningState": "str", - "uuid": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_registries_begin_update(self, resource_group): - response = await ( - await self.client.schema_registries.begin_update( - resource_group_name=resource_group.name, - schema_registry_name="str", - properties={ - "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, - "properties": {"description": "str", "displayName": "str"}, - "tags": {"str": "str"}, - }, - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_registries_begin_delete(self, resource_group): - response = await ( - await self.client.schema_registries.begin_delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_registries_list_by_resource_group(self, resource_group): - response = self.client.schema_registries.list_by_resource_group( - resource_group_name=resource_group.name, - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_registries_list_by_subscription(self, resource_group): - response = self.client.schema_registries.list_by_subscription() - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations.py deleted file mode 100644 index b3d8ec7fec57..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemaVersionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_versions_get(self, resource_group): - response = self.client.schema_versions.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_versions_create_or_replace(self, resource_group): - response = self.client.schema_versions.create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - resource={ - "id": "str", - "name": "str", - "properties": { - "schemaContent": "str", - "description": "str", - "hash": "str", - "provisioningState": "str", - "uuid": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_versions_delete(self, resource_group): - response = self.client.schema_versions.delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_versions_list_by_schema(self, resource_group): - response = self.client.schema_versions.list_by_schema( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations_async.py deleted file mode 100644 index 059ce427d8ee..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations_async.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemaVersionsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_versions_get(self, resource_group): - response = await self.client.schema_versions.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_versions_create_or_replace(self, resource_group): - response = await self.client.schema_versions.create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - resource={ - "id": "str", - "name": "str", - "properties": { - "schemaContent": "str", - "description": "str", - "hash": "str", - "provisioningState": "str", - "uuid": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_versions_delete(self, resource_group): - response = await self.client.schema_versions.delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_versions_list_by_schema(self, resource_group): - response = self.client.schema_versions.list_by_schema( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations.py deleted file mode 100644 index a588eaba29c1..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemasOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schemas_get(self, resource_group): - response = self.client.schemas.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schemas_create_or_replace(self, resource_group): - response = self.client.schemas.create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - resource={ - "id": "str", - "name": "str", - "properties": { - "format": "str", - "schemaType": "str", - "description": "str", - "displayName": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "uuid": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schemas_delete(self, resource_group): - response = self.client.schemas.delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schemas_list_by_schema_registry(self, resource_group): - response = self.client.schemas.list_by_schema_registry( - resource_group_name=resource_group.name, - schema_registry_name="str", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations_async.py deleted file mode 100644 index f8301bd79811..000000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations_async.py +++ /dev/null @@ -1,89 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemasOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schemas_get(self, resource_group): - response = await self.client.schemas.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schemas_create_or_replace(self, resource_group): - response = await self.client.schemas.create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - resource={ - "id": "str", - "name": "str", - "properties": { - "format": "str", - "schemaType": "str", - "description": "str", - "displayName": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "uuid": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schemas_delete(self, resource_group): - response = await self.client.schemas.delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schemas_list_by_schema_registry(self, resource_group): - response = self.client.schemas.list_by_schema_registry( - resource_group_name=resource_group.name, - schema_registry_name="str", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml b/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml index 044013335643..b7d07a94360f 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/deviceregistry/DeviceRegistry.Management -commit: 6132d27fe22b7876e0064827a5ac70f7a6166ab9 +commit: fc65cf29fa9f13821e6cc0cf089b7e67663d9d2e repo: Azure/azure-rest-api-specs additionalDirectories: