diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md index 44a468fb8921..3de4fd61d2fb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Desktop Virtualization Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json index 72a9c7e96f82..200237470120 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json @@ -1,11 +1,11 @@ { - "commit": "15ba5b8a954afb74a6bb8902038835f0cddb9930", + "commit": "165cd89a74e892ee1c1616cb2eeff51fe1471980", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.7", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/desktopvirtualization/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/desktopvirtualization/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", "readme": "specification/desktopvirtualization/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py index a536063e4548..835e232059af 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class DesktopVirtualizationMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for DesktopVirtualizationMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: di :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-05". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-04-03". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(DesktopVirtualizationMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-05") + api_version: str = kwargs.pop("api_version", "2024-04-03") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-desktopvirtualization/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py index 7098982a4ab5..9d1170353342 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py @@ -9,13 +9,17 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import DesktopVirtualizationMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AppAttachPackageInfoOperations, + AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, DesktopsOperations, @@ -77,15 +81,21 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :vartype session_hosts: azure.mgmt.desktopvirtualization.operations.SessionHostsOperations :ivar msix_packages: MSIXPackagesOperations operations :vartype msix_packages: azure.mgmt.desktopvirtualization.operations.MSIXPackagesOperations + :ivar app_attach_package_info: AppAttachPackageInfoOperations operations + :vartype app_attach_package_info: + azure.mgmt.desktopvirtualization.operations.AppAttachPackageInfoOperations :ivar msix_images: MsixImagesOperations operations :vartype msix_images: azure.mgmt.desktopvirtualization.operations.MsixImagesOperations + :ivar app_attach_package: AppAttachPackageOperations operations + :vartype app_attach_package: + azure.mgmt.desktopvirtualization.operations.AppAttachPackageOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-05". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-04-03". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -100,7 +110,25 @@ def __init__( self._config = DesktopVirtualizationMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -131,9 +159,15 @@ def __init__( self.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) self.session_hosts = SessionHostsOperations(self._client, self._config, self._serialize, self._deserialize) self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package_info = AppAttachPackageInfoOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package = AppAttachPackageOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -153,7 +187,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py index 4bae2292227b..2f781d740827 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +661,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1481,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1901,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py index 59deb8c7263b..e5754a47ce68 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py index cee48f65d70f..50ef97143926 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class DesktopVirtualizationMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for DesktopVirtualizationMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: di :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-05". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-04-03". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(DesktopVirtualizationMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-05") + api_version: str = kwargs.pop("api_version", "2024-04-03") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-desktopvirtualization/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py index 652ec8ef22ef..1aec6d3ecc5b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py @@ -9,13 +9,17 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import DesktopVirtualizationMgmtClientConfiguration from .operations import ( + AppAttachPackageInfoOperations, + AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, DesktopsOperations, @@ -78,15 +82,21 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :vartype session_hosts: azure.mgmt.desktopvirtualization.aio.operations.SessionHostsOperations :ivar msix_packages: MSIXPackagesOperations operations :vartype msix_packages: azure.mgmt.desktopvirtualization.aio.operations.MSIXPackagesOperations + :ivar app_attach_package_info: AppAttachPackageInfoOperations operations + :vartype app_attach_package_info: + azure.mgmt.desktopvirtualization.aio.operations.AppAttachPackageInfoOperations :ivar msix_images: MsixImagesOperations operations :vartype msix_images: azure.mgmt.desktopvirtualization.aio.operations.MsixImagesOperations + :ivar app_attach_package: AppAttachPackageOperations operations + :vartype app_attach_package: + azure.mgmt.desktopvirtualization.aio.operations.AppAttachPackageOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-05". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-04-03". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -101,7 +111,25 @@ def __init__( self._config = DesktopVirtualizationMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -132,9 +160,17 @@ def __init__( self.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) self.session_hosts = SessionHostsOperations(self._client, self._config, self._serialize, self._deserialize) self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package_info = AppAttachPackageInfoOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package = AppAttachPackageOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -154,7 +190,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py index 975df17adf61..df927dd95440 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py @@ -21,7 +21,9 @@ from ._user_sessions_operations import UserSessionsOperations from ._session_hosts_operations import SessionHostsOperations from ._msix_packages_operations import MSIXPackagesOperations +from ._app_attach_package_info_operations import AppAttachPackageInfoOperations from ._msix_images_operations import MsixImagesOperations +from ._app_attach_package_operations import AppAttachPackageOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -43,7 +45,9 @@ "UserSessionsOperations", "SessionHostsOperations", "MSIXPackagesOperations", + "AppAttachPackageInfoOperations", "MsixImagesOperations", + "AppAttachPackageOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py new file mode 100644 index 000000000000..537c33206f51 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py @@ -0,0 +1,219 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._app_attach_package_info_operations import build_import_method_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppAttachPackageInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package_info` attribute. + """ + + models = _models + + 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") + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: _models.ImportPackageInfoRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: 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 iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: Union[_models.ImportPackageInfoRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Is either a ImportPackageInfoRequest type or a IO[bytes] type. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest or IO[bytes] + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(import_package_info_request, (IOBase, bytes)): + _content = import_package_info_request + else: + _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + + def prepare_request(next_link=None): + if not next_link: + + _request = build_import_method_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py new file mode 100644 index 000000000000..89c22af71b7a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py @@ -0,0 +1,623 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._app_attach_package_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppAttachPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package` attribute. + """ + + models = _models + + 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 + async def get( + self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any + ) -> _models.AppAttachPackage: + """Get an app attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppAttachPackage] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: _models.AppAttachPackage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: 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: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: Union[_models.AppAttachPackage, IO[bytes]], + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Is either a + AppAttachPackage type or a IO[bytes] type. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage or + IO[bytes] + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package, (IOBase, bytes)): + _content = app_attach_package + else: + _json = self._serialize.body(app_attach_package, "AppAttachPackage") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any + ) -> None: + """Remove an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[_models.AppAttachPackagePatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: 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: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[Union[_models.AppAttachPackagePatch, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Is either a + AppAttachPackagePatch type or a IO[bytes] type. Default value is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + or IO[bytes] + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package_patch, (IOBase, bytes)): + _content = app_attach_package_patch + else: + if app_attach_package_patch is not None: + _json = self._serialize.body(app_attach_package_patch, "AppAttachPackagePatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """List App Attach packages in resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param filter: OData filter expression. Valid properties for filtering are package name and + host pool. Default value is None. + :type filter: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map = { + 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_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """List App Attach packages in subscription. + + :param filter: OData filter expression. Valid properties for filtering are package name, host + pool, and resource group. Default value is None. + :type filter: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map = { + 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_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py index 10f2d1388b13..79b95ea291f9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -72,7 +72,6 @@ async def get( :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -91,21 +90,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,13 +115,9 @@ async def get( deserialized = self._deserialize("ApplicationGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -147,7 +141,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -158,7 +151,7 @@ async def create_or_update( self, resource_group_name: str, application_group_name: str, - application_group: IO, + application_group: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -171,11 +164,10 @@ async def create_or_update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Required. - :type application_group: IO + :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -186,7 +178,7 @@ async def create_or_update( self, resource_group_name: str, application_group_name: str, - application_group: Union[_models.ApplicationGroup, IO], + application_group: Union[_models.ApplicationGroup, IO[bytes]], **kwargs: Any ) -> _models.ApplicationGroup: """Create or update an applicationGroup. @@ -197,12 +189,8 @@ async def create_or_update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Is either a - ApplicationGroup type or a IO type. Required. - :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ApplicationGroup type or a IO[bytes] type. Required. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup or IO[bytes] :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -230,7 +218,7 @@ async def create_or_update( else: _json = self._serialize.body(application_group, "ApplicationGroup") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -238,16 +226,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,10 +254,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, **kwargs: Any @@ -282,7 +265,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -301,21 +283,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,11 +306,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -354,7 +331,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -365,7 +341,7 @@ async def update( self, resource_group_name: str, application_group_name: str, - application_group: Optional[IO] = None, + application_group: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -379,11 +355,10 @@ async def update( :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Default value is None. - :type application_group: IO + :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -394,7 +369,7 @@ async def update( self, resource_group_name: str, application_group_name: str, - application_group: Optional[Union[_models.ApplicationGroupPatch, IO]] = None, + application_group: Optional[Union[_models.ApplicationGroupPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ApplicationGroup: """Update an applicationGroup. @@ -405,12 +380,9 @@ async def update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Is either a - ApplicationGroupPatch type or a IO type. Default value is None. - :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ApplicationGroupPatch type or a IO[bytes] type. Default value is None. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch or + IO[bytes] :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -441,7 +413,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -449,16 +421,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,13 +441,9 @@ async def update( deserialized = self._deserialize("ApplicationGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -502,7 +469,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] @@ -525,7 +491,7 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, filter=filter, @@ -533,12 +499,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -550,13 +515,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationGroupList", pipeline_response) @@ -566,11 +531,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -582,10 +547,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups" - } - @distributed_trace def list_by_subscription( self, filter: Optional[str] = None, **kwargs: Any @@ -595,7 +556,6 @@ def list_by_subscription( :param filter: OData filter expression. Valid properties for filtering are applicationGroupType. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] @@ -618,16 +578,15 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -639,13 +598,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationGroupList", pipeline_response) @@ -655,11 +614,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,7 +629,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py index c6a2f7602535..1ec13d7fdaed 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -74,7 +74,6 @@ async def get( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -93,22 +92,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -120,13 +118,9 @@ async def get( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -154,7 +148,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -166,7 +159,7 @@ async def create_or_update( resource_group_name: str, application_group_name: str, application_name: str, - application: IO, + application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -182,11 +175,10 @@ async def create_or_update( Required. :type application_name: str :param application: Object containing Application definitions. Required. - :type application: IO + :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -198,7 +190,7 @@ async def create_or_update( resource_group_name: str, application_group_name: str, application_name: str, - application: Union[_models.Application, IO], + application: Union[_models.Application, IO[bytes]], **kwargs: Any ) -> _models.Application: """Create or update an application. @@ -212,12 +204,8 @@ async def create_or_update( Required. :type application_name: str :param application: Object containing Application definitions. Is either a Application type or - a IO type. Required. - :type application: ~azure.mgmt.desktopvirtualization.models.Application or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + a IO[bytes] type. Required. + :type application: ~azure.mgmt.desktopvirtualization.models.Application or IO[bytes] :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -245,7 +233,7 @@ async def create_or_update( else: _json = self._serialize.body(application, "Application") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, @@ -254,16 +242,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -283,10 +270,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, application_name: str, **kwargs: Any @@ -301,7 +284,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -320,22 +302,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,11 +326,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -377,7 +354,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -389,7 +365,7 @@ async def update( resource_group_name: str, application_group_name: str, application_name: str, - application: Optional[IO] = None, + application: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -405,11 +381,10 @@ async def update( Required. :type application_name: str :param application: Object containing Application definitions. Default value is None. - :type application: IO + :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -421,7 +396,7 @@ async def update( resource_group_name: str, application_group_name: str, application_name: str, - application: Optional[Union[_models.ApplicationPatch, IO]] = None, + application: Optional[Union[_models.ApplicationPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Application: """Update an application. @@ -435,12 +410,8 @@ async def update( Required. :type application_name: str :param application: Object containing Application definitions. Is either a ApplicationPatch - type or a IO type. Default value is None. - :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Default value is None. + :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch or IO[bytes] :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -471,7 +442,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, @@ -480,16 +451,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -501,13 +471,9 @@ async def update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -532,7 +498,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Application or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.Application] @@ -555,7 +520,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -563,12 +528,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -580,13 +544,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationList", pipeline_response) @@ -596,11 +560,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +575,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py index c79a581b8667..b7aa51147f91 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -67,7 +67,6 @@ async def get( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -86,22 +85,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Desktop] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, desktop_name=desktop_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -113,13 +111,9 @@ async def get( deserialized = self._deserialize("Desktop", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}" - } + return deserialized # type: ignore @overload async def update( @@ -146,7 +140,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -158,7 +151,7 @@ async def update( resource_group_name: str, application_group_name: str, desktop_name: str, - desktop: Optional[IO] = None, + desktop: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -173,11 +166,10 @@ async def update( :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str :param desktop: Object containing Desktop definitions. Default value is None. - :type desktop: IO + :type desktop: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -189,7 +181,7 @@ async def update( resource_group_name: str, application_group_name: str, desktop_name: str, - desktop: Optional[Union[_models.DesktopPatch, IO]] = None, + desktop: Optional[Union[_models.DesktopPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Desktop: """Update a desktop. @@ -201,13 +193,9 @@ async def update( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str - :param desktop: Object containing Desktop definitions. Is either a DesktopPatch type or a IO - type. Default value is None. - :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param desktop: Object containing Desktop definitions. Is either a DesktopPatch type or a + IO[bytes] type. Default value is None. + :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch or IO[bytes] :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -238,7 +226,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, desktop_name=desktop_name, @@ -247,16 +235,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -268,13 +255,9 @@ async def update( deserialized = self._deserialize("Desktop", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -299,7 +282,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Desktop or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.Desktop] @@ -322,7 +304,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -330,12 +312,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -347,13 +328,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DesktopList", pipeline_response) @@ -363,11 +344,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,7 +359,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py index e43c8f1f9c72..499b0e36f145 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -71,7 +71,6 @@ async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -90,21 +89,20 @@ async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostPool] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,13 +114,9 @@ async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any deserialized = self._deserialize("HostPool", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -146,7 +140,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -157,7 +150,7 @@ async def create_or_update( self, resource_group_name: str, host_pool_name: str, - host_pool: IO, + host_pool: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -170,11 +163,10 @@ async def create_or_update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Required. - :type host_pool: IO + :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -182,7 +174,11 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, resource_group_name: str, host_pool_name: str, host_pool: Union[_models.HostPool, IO], **kwargs: Any + self, + resource_group_name: str, + host_pool_name: str, + host_pool: Union[_models.HostPool, IO[bytes]], + **kwargs: Any ) -> _models.HostPool: """Create or update a host pool. @@ -191,13 +187,9 @@ async def create_or_update( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :param host_pool: Object containing HostPool definitions. Is either a HostPool type or a IO - type. Required. - :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param host_pool: Object containing HostPool definitions. Is either a HostPool type or a + IO[bytes] type. Required. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool or IO[bytes] :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -225,7 +217,7 @@ async def create_or_update( else: _json = self._serialize.body(host_pool, "HostPool") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -233,16 +225,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -262,10 +253,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, force: Optional[bool] = None, **kwargs: Any @@ -279,7 +266,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type host_pool_name: str :param force: Force flag to delete sessionHost. Default value is None. :type force: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -298,22 +284,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, force=force, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,11 +308,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -351,7 +332,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -362,7 +342,7 @@ async def update( self, resource_group_name: str, host_pool_name: str, - host_pool: Optional[IO] = None, + host_pool: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -375,11 +355,10 @@ async def update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Default value is None. - :type host_pool: IO + :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -390,7 +369,7 @@ async def update( self, resource_group_name: str, host_pool_name: str, - host_pool: Optional[Union[_models.HostPoolPatch, IO]] = None, + host_pool: Optional[Union[_models.HostPoolPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.HostPool: """Update a host pool. @@ -401,12 +380,8 @@ async def update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Is either a HostPoolPatch type or a - IO type. Default value is None. - :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Default value is None. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch or IO[bytes] :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -437,7 +412,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -445,16 +420,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,13 +440,9 @@ async def update( deserialized = self._deserialize("HostPool", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -494,7 +464,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPool or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.HostPool] @@ -517,19 +486,18 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -541,13 +509,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("HostPoolList", pipeline_response) @@ -557,11 +525,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,10 +541,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools" - } - @distributed_trace def list( self, @@ -593,7 +557,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPool or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.HostPool] @@ -616,18 +579,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -639,13 +601,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("HostPoolList", pipeline_response) @@ -655,11 +617,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -671,8 +633,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools"} - @distributed_trace_async async def retrieve_registration_token( self, resource_group_name: str, host_pool_name: str, **kwargs: Any @@ -684,7 +644,6 @@ async def retrieve_registration_token( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistrationInfo or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :raises ~azure.core.exceptions.HttpResponseError: @@ -703,21 +662,20 @@ async def retrieve_registration_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RegistrationInfo] = kwargs.pop("cls", None) - request = build_retrieve_registration_token_request( + _request = build_retrieve_registration_token_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve_registration_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -729,10 +687,6 @@ async def retrieve_registration_token( deserialized = self._deserialize("RegistrationInfo", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - retrieve_registration_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken" - } + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py index 804795747ad5..0dcd72d083db 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -75,7 +75,6 @@ def expand( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] @@ -87,7 +86,7 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: IO, + msix_image_uri: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -100,11 +99,10 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. Required. - :type msix_image_uri: IO + :type msix_image_uri: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] @@ -116,7 +114,7 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: Union[_models.MSIXImageURI, IO], + msix_image_uri: Union[_models.MSIXImageURI, IO[bytes]], **kwargs: Any ) -> AsyncIterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. @@ -127,12 +125,8 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. Is either a MSIXImageURI type or a - IO type. Required. - :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI or IO[bytes] :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] @@ -163,7 +157,7 @@ def expand( def prepare_request(next_link=None): if not next_link: - request = build_expand_request( + _request = build_expand_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -171,12 +165,11 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.expand.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -188,13 +181,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ExpandMsixImageList", pipeline_response) @@ -204,11 +197,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,7 +212,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - expand.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py index a4957ef54d9b..d56cf9b97f6d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -74,7 +74,6 @@ async def get( :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. Required. :type msix_package_full_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -93,22 +92,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MSIXPackage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -120,13 +118,9 @@ async def get( deserialized = self._deserialize("MSIXPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -154,7 +148,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -166,7 +159,7 @@ async def create_or_update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: IO, + msix_package: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -182,11 +175,10 @@ async def create_or_update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Required. - :type msix_package: IO + :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -198,7 +190,7 @@ async def create_or_update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Union[_models.MSIXPackage, IO], + msix_package: Union[_models.MSIXPackage, IO[bytes]], **kwargs: Any ) -> _models.MSIXPackage: """Create or update a MSIX package. @@ -212,12 +204,8 @@ async def create_or_update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackage type - or a IO type. Required. - :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage or IO[bytes] :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -245,7 +233,7 @@ async def create_or_update( else: _json = self._serialize.body(msix_package, "MSIXPackage") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, @@ -254,16 +242,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -283,10 +270,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, **kwargs: Any @@ -301,7 +284,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. Required. :type msix_package_full_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -320,22 +302,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,11 +326,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -377,7 +354,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -389,7 +365,7 @@ async def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[IO] = None, + msix_package: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -405,11 +381,10 @@ async def update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Default value is None. - :type msix_package: IO + :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -421,7 +396,7 @@ async def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[Union[_models.MSIXPackagePatch, IO]] = None, + msix_package: Optional[Union[_models.MSIXPackagePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.MSIXPackage: """Update an MSIX Package. @@ -435,12 +410,8 @@ async def update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackagePatch - type or a IO type. Default value is None. - :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Default value is None. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch or IO[bytes] :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -471,7 +442,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, @@ -480,16 +451,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -501,13 +471,9 @@ async def update( deserialized = self._deserialize("MSIXPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -532,7 +498,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MSIXPackage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.MSIXPackage] @@ -555,7 +520,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -563,12 +528,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -580,13 +544,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("MSIXPackageList", pipeline_response) @@ -596,11 +560,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +575,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py index 0c255d1ee075..1e7e25d65ff0 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -56,7 +56,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]: """List all of the available operations the Desktop Virtualization resource provider supports. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceProviderOperation or the result of cls(response) :rtype: @@ -80,14 +79,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -99,13 +97,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) @@ -115,11 +113,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -130,5 +128,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.DesktopVirtualization/operations"} diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py index 9add67da79b4..cafd81b150f5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -74,7 +74,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -98,17 +97,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +118,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) @@ -136,11 +134,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,10 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections" - } - @distributed_trace_async async def get_by_workspace( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -170,7 +164,6 @@ async def get_by_workspace( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -189,22 +182,21 @@ async def get_by_workspace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionWithSystemData] = kwargs.pop("cls", None) - request = build_get_by_workspace_request( + _request = build_get_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,13 +208,9 @@ async def get_by_workspace( deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete_by_workspace( # pylint: disable=inconsistent-return-statements @@ -238,7 +226,6 @@ async def delete_by_workspace( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -257,22 +244,21 @@ async def delete_by_workspace( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_by_workspace_request( + _request = build_delete_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,11 +268,7 @@ async def delete_by_workspace( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update_by_workspace( @@ -314,7 +296,6 @@ async def update_by_workspace( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -326,7 +307,7 @@ async def update_by_workspace( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - connection: IO, + connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -342,11 +323,10 @@ async def update_by_workspace( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Required. - :type connection: IO + :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +338,7 @@ async def update_by_workspace( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO], + connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: """Approve or reject a private endpoint connection. @@ -372,12 +352,9 @@ async def update_by_workspace( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or + IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -405,7 +382,7 @@ async def update_by_workspace( else: _json = self._serialize.body(connection, "PrivateEndpointConnection") - request = build_update_by_workspace_request( + _request = build_update_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -414,16 +391,15 @@ async def update_by_workspace( content_type=content_type, json=_json, content=_content, - template_url=self.update_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,13 +411,9 @@ async def update_by_workspace( deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def list_by_host_pool( @@ -466,7 +438,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -490,7 +461,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -498,12 +469,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -515,13 +485,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) @@ -531,11 +501,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,10 +517,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections" - } - @distributed_trace_async async def get_by_host_pool( self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -565,7 +531,6 @@ async def get_by_host_pool( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -584,22 +549,21 @@ async def get_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionWithSystemData] = kwargs.pop("cls", None) - request = build_get_by_host_pool_request( + _request = build_get_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,13 +575,9 @@ async def get_by_host_pool( deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements @@ -633,7 +593,6 @@ async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -652,22 +611,21 @@ async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_by_host_pool_request( + _request = build_delete_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -677,11 +635,7 @@ async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update_by_host_pool( @@ -709,7 +663,6 @@ async def update_by_host_pool( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -721,7 +674,7 @@ async def update_by_host_pool( resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, - connection: IO, + connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -737,11 +690,10 @@ async def update_by_host_pool( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Required. - :type connection: IO + :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -753,7 +705,7 @@ async def update_by_host_pool( resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO], + connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: """Approve or reject a private endpoint connection. @@ -767,12 +719,9 @@ async def update_by_host_pool( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or + IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -800,7 +749,7 @@ async def update_by_host_pool( else: _json = self._serialize.body(connection, "PrivateEndpointConnection") - request = build_update_by_host_pool_request( + _request = build_update_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -809,16 +758,15 @@ async def update_by_host_pool( content_type=content_type, json=_json, content=_content, - template_url=self.update_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -830,10 +778,6 @@ async def update_by_host_pool( deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py index 8ad224b15a8f..008ea9a734b8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,7 +78,6 @@ def list_by_workspace( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] @@ -101,7 +100,7 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -109,12 +108,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -126,13 +124,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -142,11 +140,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,10 +156,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources" - } - @distributed_trace def list_by_host_pool( self, @@ -185,7 +179,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] @@ -208,7 +201,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -216,12 +209,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -233,13 +225,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -249,11 +241,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -264,7 +256,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_personal_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_personal_schedules_operations.py index 5f2a11824667..064253cd9f2c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_personal_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_personal_schedules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -73,7 +73,6 @@ async def get( :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -92,22 +91,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPersonalSchedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -119,13 +117,9 @@ async def get( deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @overload async def create( @@ -154,7 +148,6 @@ async def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -166,7 +159,7 @@ async def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: IO, + scaling_plan_schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -182,11 +175,10 @@ async def create( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Required. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -198,7 +190,7 @@ async def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Union[_models.ScalingPlanPersonalSchedule, IO], + scaling_plan_schedule: Union[_models.ScalingPlanPersonalSchedule, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Create or update a ScalingPlanPersonalSchedule. @@ -211,13 +203,9 @@ async def create( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Is - either a ScalingPlanPersonalSchedule type or a IO type. Required. + either a ScalingPlanPersonalSchedule type or a IO[bytes] type. Required. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule or IO[bytes] :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -245,7 +233,7 @@ async def create( else: _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPersonalSchedule") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -254,16 +242,15 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -283,10 +270,6 @@ async def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -300,7 +283,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -319,22 +301,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -344,11 +325,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -377,7 +354,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -389,7 +365,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO] = None, + scaling_plan_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -405,11 +381,10 @@ async def update( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Default value is None. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -421,7 +396,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO]] = None, + scaling_plan_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Update a ScalingPlanPersonalSchedule. @@ -434,13 +409,9 @@ async def update( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Is - either a ScalingPlanPersonalSchedulePatch type or a IO type. Default value is None. + either a ScalingPlanPersonalSchedulePatch type or a IO[bytes] type. Default value is None. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch or IO[bytes] :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -471,7 +442,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -480,16 +451,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -501,13 +471,9 @@ async def update( deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -532,7 +498,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanPersonalSchedule or the result of cls(response) :rtype: @@ -556,7 +521,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -564,12 +529,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -581,13 +545,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanPersonalScheduleList", pipeline_response) @@ -597,11 +561,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -612,7 +576,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_pooled_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_pooled_schedules_operations.py index 4288a390118d..e0e12b5feebd 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_pooled_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_pooled_schedules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -73,7 +73,6 @@ async def get( :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -92,22 +91,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPooledSchedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -119,13 +117,9 @@ async def get( deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @overload async def create( @@ -153,7 +147,6 @@ async def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -165,7 +158,7 @@ async def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: IO, + scaling_plan_schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -181,11 +174,10 @@ async def create( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Required. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -197,7 +189,7 @@ async def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Union[_models.ScalingPlanPooledSchedule, IO], + scaling_plan_schedule: Union[_models.ScalingPlanPooledSchedule, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Create or update a ScalingPlanPooledSchedule. @@ -210,13 +202,9 @@ async def create( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Is - either a ScalingPlanPooledSchedule type or a IO type. Required. + either a ScalingPlanPooledSchedule type or a IO[bytes] type. Required. :type scaling_plan_schedule: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or IO[bytes] :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -244,7 +232,7 @@ async def create( else: _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPooledSchedule") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -253,16 +241,15 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,10 +269,6 @@ async def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -299,7 +282,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -318,22 +300,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,11 +324,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -376,7 +353,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -388,7 +364,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO] = None, + scaling_plan_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -404,11 +380,10 @@ async def update( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Default value is None. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -420,7 +395,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO]] = None, + scaling_plan_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Update a ScalingPlanPooledSchedule. @@ -433,13 +408,9 @@ async def update( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Is - either a ScalingPlanPooledSchedulePatch type or a IO type. Default value is None. + either a ScalingPlanPooledSchedulePatch type or a IO[bytes] type. Default value is None. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch or IO[bytes] :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -470,7 +441,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -479,16 +450,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -500,13 +470,9 @@ async def update( deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -531,7 +497,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanPooledSchedule or the result of cls(response) :rtype: @@ -555,7 +520,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -563,12 +528,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -580,13 +544,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanPooledScheduleList", pipeline_response) @@ -596,11 +560,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +575,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py index 07a18ba75c65..f905e3db7961 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -71,7 +71,6 @@ async def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -90,21 +89,20 @@ async def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlan] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,13 +114,9 @@ async def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: deserialized = self._deserialize("ScalingPlan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return deserialized # type: ignore @overload async def create( @@ -146,7 +140,6 @@ async def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -157,7 +150,7 @@ async def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: IO, + scaling_plan: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -170,11 +163,10 @@ async def create( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Required. - :type scaling_plan: IO + :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -185,7 +177,7 @@ async def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Union[_models.ScalingPlan, IO], + scaling_plan: Union[_models.ScalingPlan, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlan: """Create or update a scaling plan. @@ -196,12 +188,8 @@ async def create( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Is either a ScalingPlan type - or a IO type. Required. - :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan or IO[bytes] :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -229,7 +217,7 @@ async def create( else: _json = self._serialize.body(scaling_plan, "ScalingPlan") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -237,16 +225,15 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -266,10 +253,6 @@ async def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any @@ -281,7 +264,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -300,21 +282,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,11 +305,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -352,7 +329,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -363,7 +339,7 @@ async def update( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[IO] = None, + scaling_plan: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -376,11 +352,10 @@ async def update( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Default value is None. - :type scaling_plan: IO + :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -391,7 +366,7 @@ async def update( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO]] = None, + scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlan: """Update a scaling plan. @@ -402,12 +377,8 @@ async def update( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Is either a ScalingPlanPatch - type or a IO type. Default value is None. - :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Default value is None. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch or IO[bytes] :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -438,7 +409,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -446,16 +417,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -467,13 +437,9 @@ async def update( deserialized = self._deserialize("ScalingPlan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -495,7 +461,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] @@ -518,19 +483,18 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -542,13 +506,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -558,11 +522,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,10 +538,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans" - } - @distributed_trace def list_by_subscription( self, @@ -594,7 +554,6 @@ def list_by_subscription( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] @@ -617,18 +576,17 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -640,13 +598,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -656,11 +614,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,10 +630,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans" - } - @distributed_trace def list_by_host_pool( self, @@ -699,7 +653,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] @@ -722,7 +675,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -730,12 +683,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -747,13 +699,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -763,11 +715,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -778,7 +730,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py index fb715071fc1d..b246f45dd194 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -73,7 +73,6 @@ async def get( :param session_host_name: The name of the session host within the specified host pool. Required. :type session_host_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -92,22 +91,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SessionHost] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -119,13 +117,9 @@ async def get( deserialized = self._deserialize("SessionHost", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -149,7 +143,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param force: Force flag to force sessionHost deletion even when userSession exists. Default value is None. :type force: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -168,23 +161,22 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, subscription_id=self._config.subscription_id, force=force, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,11 +186,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -230,7 +218,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -243,7 +230,7 @@ async def update( host_pool_name: str, session_host_name: str, force: Optional[bool] = None, - session_host: Optional[IO] = None, + session_host: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -262,11 +249,10 @@ async def update( is None. :type force: bool :param session_host: Object containing SessionHost definitions. Default value is None. - :type session_host: IO + :type session_host: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -279,7 +265,7 @@ async def update( host_pool_name: str, session_host_name: str, force: Optional[bool] = None, - session_host: Optional[Union[_models.SessionHostPatch, IO]] = None, + session_host: Optional[Union[_models.SessionHostPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.SessionHost: """Update a session host. @@ -296,12 +282,8 @@ async def update( is None. :type force: bool :param session_host: Object containing SessionHost definitions. Is either a SessionHostPatch - type or a IO type. Default value is None. - :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Default value is None. + :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch or IO[bytes] :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -332,7 +314,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -342,16 +324,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -363,13 +344,9 @@ async def update( deserialized = self._deserialize("SessionHost", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -394,7 +371,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SessionHost or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHost] @@ -417,7 +393,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -425,12 +401,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -442,13 +417,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("SessionHostList", pipeline_response) @@ -458,11 +433,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -473,7 +448,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py index 588bd942aee8..ad0d400459f3 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -75,7 +75,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StartMenuItem or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.StartMenuItem] @@ -98,7 +97,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -106,12 +105,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -123,13 +121,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("StartMenuItemList", pipeline_response) @@ -139,11 +137,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -154,7 +152,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py index 5be197d547e6..87b6b03b79db 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -88,7 +88,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSession or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.UserSession] @@ -111,7 +110,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -120,12 +119,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -137,13 +135,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("UserSessionList", pipeline_response) @@ -153,11 +151,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -169,10 +167,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions" - } - @distributed_trace_async async def get( self, resource_group_name: str, host_pool_name: str, session_host_name: str, user_session_id: str, **kwargs: Any @@ -190,7 +184,6 @@ async def get( :param user_session_id: The name of the user session within the specified session host. Required. :type user_session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSession or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.UserSession :raises ~azure.core.exceptions.HttpResponseError: @@ -209,23 +202,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserSession] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, user_session_id=user_session_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,13 +229,9 @@ async def get( deserialized = self._deserialize("UserSession", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -270,7 +258,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type user_session_id: str :param force: Force flag to login off userSession. Default value is None. :type force: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -289,7 +276,7 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -297,16 +284,15 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, force=force, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,11 +302,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list( @@ -349,7 +331,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSession or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.UserSession] @@ -372,7 +353,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -381,12 +362,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -398,13 +378,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("UserSessionList", pipeline_response) @@ -414,11 +394,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,10 +410,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions" - } - @distributed_trace_async async def disconnect( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, session_host_name: str, user_session_id: str, **kwargs: Any @@ -451,7 +427,6 @@ async def disconnect( # pylint: disable=inconsistent-return-statements :param user_session_id: The name of the user session within the specified session host. Required. :type user_session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -470,23 +445,22 @@ async def disconnect( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_disconnect_request( + _request = build_disconnect_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, user_session_id=user_session_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.disconnect.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -496,11 +470,7 @@ async def disconnect( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - disconnect.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def send_message( # pylint: disable=inconsistent-return-statements @@ -533,7 +503,6 @@ async def send_message( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -546,7 +515,7 @@ async def send_message( # pylint: disable=inconsistent-return-statements host_pool_name: str, session_host_name: str, user_session_id: str, - send_message: Optional[IO] = None, + send_message: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -566,11 +535,10 @@ async def send_message( # pylint: disable=inconsistent-return-statements :type user_session_id: str :param send_message: Object containing message includes title and message body. Default value is None. - :type send_message: IO + :type send_message: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -583,7 +551,7 @@ async def send_message( # pylint: disable=inconsistent-return-statements host_pool_name: str, session_host_name: str, user_session_id: str, - send_message: Optional[Union[_models.SendMessage, IO]] = None, + send_message: Optional[Union[_models.SendMessage, IO[bytes]]] = None, **kwargs: Any ) -> None: """Send a message to a user. @@ -600,12 +568,8 @@ async def send_message( # pylint: disable=inconsistent-return-statements Required. :type user_session_id: str :param send_message: Object containing message includes title and message body. Is either a - SendMessage type or a IO type. Default value is None. - :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + SendMessage type or a IO[bytes] type. Default value is None. + :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -636,7 +600,7 @@ async def send_message( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_send_message_request( + _request = build_send_message_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -646,16 +610,15 @@ async def send_message( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.send_message.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -665,8 +628,4 @@ async def send_message( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - send_message.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py index 5c93e9d08b3d..e6bc74a3be72 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -70,7 +70,6 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -89,21 +88,20 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -115,13 +113,9 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -145,7 +139,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -156,7 +149,7 @@ async def create_or_update( self, resource_group_name: str, workspace_name: str, - workspace: IO, + workspace: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -169,11 +162,10 @@ async def create_or_update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Required. - :type workspace: IO + :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -181,7 +173,11 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, resource_group_name: str, workspace_name: str, workspace: Union[_models.Workspace, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + workspace: Union[_models.Workspace, IO[bytes]], + **kwargs: Any ) -> _models.Workspace: """Create or update a workspace. @@ -190,13 +186,9 @@ async def create_or_update( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :param workspace: Object containing Workspace definitions. Is either a Workspace type or a IO - type. Required. - :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param workspace: Object containing Workspace definitions. Is either a Workspace type or a + IO[bytes] type. Required. + :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace or IO[bytes] :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -224,7 +216,7 @@ async def create_or_update( else: _json = self._serialize.body(workspace, "Workspace") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -232,16 +224,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -261,10 +252,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, **kwargs: Any @@ -276,7 +263,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -295,21 +281,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,11 +304,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -347,7 +328,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +338,7 @@ async def update( self, resource_group_name: str, workspace_name: str, - workspace: Optional[IO] = None, + workspace: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -371,11 +351,10 @@ async def update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Default value is None. - :type workspace: IO + :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -386,7 +365,7 @@ async def update( self, resource_group_name: str, workspace_name: str, - workspace: Optional[Union[_models.WorkspacePatch, IO]] = None, + workspace: Optional[Union[_models.WorkspacePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Workspace: """Update a workspace. @@ -397,12 +376,8 @@ async def update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Is either a WorkspacePatch type or a - IO type. Default value is None. - :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Default value is None. + :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch or IO[bytes] :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -433,7 +408,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -441,16 +416,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -462,13 +436,9 @@ async def update( deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -490,7 +460,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.Workspace] @@ -513,19 +482,18 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -537,13 +505,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceList", pipeline_response) @@ -553,11 +521,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -569,15 +537,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces" - } - @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspace"]: """List workspaces in subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.Workspace] @@ -600,15 +563,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspac def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -620,13 +582,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceList", pipeline_response) @@ -636,11 +598,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +613,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py index 7609aaaadd1d..6fabf29a0aff 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py @@ -8,6 +8,12 @@ from ._models_py3 import AgentUpdatePatchProperties from ._models_py3 import AgentUpdateProperties +from ._models_py3 import AppAttachPackage +from ._models_py3 import AppAttachPackageInfoProperties +from ._models_py3 import AppAttachPackageList +from ._models_py3 import AppAttachPackagePatch +from ._models_py3 import AppAttachPackagePatchProperties +from ._models_py3 import AppAttachPackageProperties from ._models_py3 import Application from ._models_py3 import ApplicationGroup from ._models_py3 import ApplicationGroupList @@ -18,12 +24,16 @@ from ._models_py3 import Desktop from ._models_py3 import DesktopList from ._models_py3 import DesktopPatch +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse from ._models_py3 import ExpandMsixImage from ._models_py3 import ExpandMsixImageList from ._models_py3 import HostPool from ._models_py3 import HostPoolList from ._models_py3 import HostPoolPatch from ._models_py3 import Identity +from ._models_py3 import ImportPackageInfoRequest from ._models_py3 import LogSpecification from ._models_py3 import MSIXImageURI from ._models_py3 import MSIXPackage @@ -76,26 +86,31 @@ from ._models_py3 import StartMenuItemList from ._models_py3 import SystemData from ._models_py3 import Time +from ._models_py3 import TrackedResource from ._models_py3 import UserSession from ._models_py3 import UserSessionList from ._models_py3 import Workspace from ._models_py3 import WorkspaceList from ._models_py3 import WorkspacePatch +from ._desktop_virtualization_mgmt_client_enums import AppAttachPackageArchitectures from ._desktop_virtualization_mgmt_client_enums import ApplicationGroupType from ._desktop_virtualization_mgmt_client_enums import ApplicationType from ._desktop_virtualization_mgmt_client_enums import CommandLineSetting from ._desktop_virtualization_mgmt_client_enums import CreatedByType from ._desktop_virtualization_mgmt_client_enums import DayOfWeek +from ._desktop_virtualization_mgmt_client_enums import FailHealthCheckOnStagingFailure from ._desktop_virtualization_mgmt_client_enums import HealthCheckName from ._desktop_virtualization_mgmt_client_enums import HealthCheckResult from ._desktop_virtualization_mgmt_client_enums import HostPoolType from ._desktop_virtualization_mgmt_client_enums import HostpoolPublicNetworkAccess from ._desktop_virtualization_mgmt_client_enums import LoadBalancerType +from ._desktop_virtualization_mgmt_client_enums import PackageTimestamped from ._desktop_virtualization_mgmt_client_enums import PersonalDesktopAssignmentType from ._desktop_virtualization_mgmt_client_enums import PreferredAppGroupType from ._desktop_virtualization_mgmt_client_enums import PrivateEndpointConnectionProvisioningState from ._desktop_virtualization_mgmt_client_enums import PrivateEndpointServiceConnectionStatus +from ._desktop_virtualization_mgmt_client_enums import ProvisioningState from ._desktop_virtualization_mgmt_client_enums import PublicNetworkAccess from ._desktop_virtualization_mgmt_client_enums import RegistrationTokenOperation from ._desktop_virtualization_mgmt_client_enums import RemoteApplicationType @@ -119,6 +134,12 @@ __all__ = [ "AgentUpdatePatchProperties", "AgentUpdateProperties", + "AppAttachPackage", + "AppAttachPackageInfoProperties", + "AppAttachPackageList", + "AppAttachPackagePatch", + "AppAttachPackagePatchProperties", + "AppAttachPackageProperties", "Application", "ApplicationGroup", "ApplicationGroupList", @@ -129,12 +150,16 @@ "Desktop", "DesktopList", "DesktopPatch", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", "ExpandMsixImage", "ExpandMsixImageList", "HostPool", "HostPoolList", "HostPoolPatch", "Identity", + "ImportPackageInfoRequest", "LogSpecification", "MSIXImageURI", "MSIXPackage", @@ -187,25 +212,30 @@ "StartMenuItemList", "SystemData", "Time", + "TrackedResource", "UserSession", "UserSessionList", "Workspace", "WorkspaceList", "WorkspacePatch", + "AppAttachPackageArchitectures", "ApplicationGroupType", "ApplicationType", "CommandLineSetting", "CreatedByType", "DayOfWeek", + "FailHealthCheckOnStagingFailure", "HealthCheckName", "HealthCheckResult", "HostPoolType", "HostpoolPublicNetworkAccess", "LoadBalancerType", + "PackageTimestamped", "PersonalDesktopAssignmentType", "PreferredAppGroupType", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", + "ProvisioningState", "PublicNetworkAccess", "RegistrationTokenOperation", "RemoteApplicationType", diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py index 378b4904fcfd..81bb4af5b02b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py @@ -10,6 +10,18 @@ from azure.core import CaseInsensitiveEnumMeta +class AppAttachPackageArchitectures(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Possible device architectures that an app attach package can be configured for.""" + + ARM = "ARM" + ARM64 = "ARM64" + X86 = "x86" + X64 = "x64" + NEUTRAL = "Neutral" + X86_A64 = "x86a64" + ALL = "ALL" + + class ApplicationGroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource Type of ApplicationGroup.""" @@ -56,61 +68,69 @@ class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): SUNDAY = "Sunday" +class FailHealthCheckOnStagingFailure(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Parameter indicating how the health check should behave if this package fails staging.""" + + UNHEALTHY = "Unhealthy" + NEEDS_ASSISTANCE = "NeedsAssistance" + DO_NOT_FAIL = "DoNotFail" + + class HealthCheckName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Represents the name of the health check operation performed.""" DOMAIN_JOINED_CHECK = "DomainJoinedCheck" """Verifies the SessionHost is joined to a domain. If this check fails is classified as fatal as - #: no connection can succeed if the SessionHost is not joined to the domain. (Currently Enabled)""" + no connection can succeed if the SessionHost is not joined to the domain. (Currently Enabled)""" DOMAIN_TRUST_CHECK = "DomainTrustCheck" """Verifies the SessionHost is not experiencing domain trust issues that will prevent - #: authentication on SessionHost at connection time when session is created. If this check fails - #: is classified as fatal as no connection can succeed if we cannot reach the domain for - #: authentication on the SessionHost. (Currently Enabled)""" + authentication on SessionHost at connection time when session is created. If this check fails + is classified as fatal as no connection can succeed if we cannot reach the domain for + authentication on the SessionHost. (Currently Enabled)""" FS_LOGIX_HEALTH_CHECK = "FSLogixHealthCheck" """Verifies the FSLogix service is up and running to make sure users' profiles are loaded in the - #: session. If this check fails is classified as fatal as even if the connection can succeed, user - #: experience is bad as the user profile cannot be loaded and user will get a temporary profile in - #: the session. (Currently Disabled)""" + session. If this check fails is classified as fatal as even if the connection can succeed, user + experience is bad as the user profile cannot be loaded and user will get a temporary profile in + the session. (Currently Disabled)""" SX_S_STACK_LISTENER_CHECK = "SxSStackListenerCheck" """Verifies that the SxS stack is up and running so connections can succeed. If this check fails - #: is classified as fatal as no connection can succeed if the SxS stack is not ready. (Currently - #: Enabled)""" + is classified as fatal as no connection can succeed if the SxS stack is not ready. (Currently + Enabled)""" URLS_ACCESSIBLE_CHECK = "UrlsAccessibleCheck" """Verifies that the required WVD service and Geneva URLs are reachable from the SessionHost. - #: These URLs are: RdTokenUri, RdBrokerURI, RdDiagnosticsUri and storage blob URLs for agent - #: monitoring (geneva). If this check fails, it is non fatal and the machine still can service - #: connections, main issue may be that monitoring agent is unable to store warm path data (logs, - #: operations ...). (Currently Disabled)""" + These URLs are: RdTokenUri, RdBrokerURI, RdDiagnosticsUri and storage blob URLs for agent + monitoring (geneva). If this check fails, it is non fatal and the machine still can service + connections, main issue may be that monitoring agent is unable to store warm path data (logs, + operations ...). (Currently Disabled)""" MONITORING_AGENT_CHECK = "MonitoringAgentCheck" """Verifies that the required Geneva agent is running. If this check fails, it is non fatal and - #: the machine still can service connections, main issue may be that monitoring agent is missing - #: or running (possibly) older version. (Currently Enabled)""" + the machine still can service connections, main issue may be that monitoring agent is missing + or running (possibly) older version. (Currently Enabled)""" DOMAIN_REACHABLE = "DomainReachable" """Verifies the domain the SessionHost is joined to is still reachable. If this check fails is - #: classified as fatal as no connection can succeed if the domain the SessionHost is joined is not - #: reachable at the time of connection. (Currently Disabled)""" + classified as fatal as no connection can succeed if the domain the SessionHost is joined is not + reachable at the time of connection. (Currently Disabled)""" WEB_RTC_REDIRECTOR_CHECK = "WebRTCRedirectorCheck" """Verifies whether the WebRTCRedirector component is healthy. The WebRTCRedirector component is - #: used to optimize video and audio performance in Microsoft Teams. This checks whether the - #: component is still running, and whether there is a higher version available. If this check - #: fails, it is non fatal and the machine still can service connections, main issue may be the - #: WebRTCRedirector component has to be restarted or updated. (Currently Disabled)""" + used to optimize video and audio performance in Microsoft Teams. This checks whether the + component is still running, and whether there is a higher version available. If this check + fails, it is non fatal and the machine still can service connections, main issue may be the + WebRTCRedirector component has to be restarted or updated. (Currently Disabled)""" SUPPORTED_ENCRYPTION_CHECK = "SupportedEncryptionCheck" """Verifies the value of SecurityLayer registration key. If the value is 0 (SecurityLayer.RDP) - #: this check fails with Error code = NativeMethodErrorCode.E_FAIL and is fatal. If the value is 1 - #: (SecurityLayer.Negotiate) this check fails with Error code = - #: NativeMethodErrorCode.ERROR_SUCCESS and is non fatal. (Currently Disabled)""" + this check fails with Error code = NativeMethodErrorCode.E_FAIL and is fatal. If the value is 1 + (SecurityLayer.Negotiate) this check fails with Error code = + NativeMethodErrorCode.ERROR_SUCCESS and is non fatal. (Currently Disabled)""" META_DATA_SERVICE_CHECK = "MetaDataServiceCheck" """Verifies the metadata service is accessible and return compute properties. (Currently Enabled)""" APP_ATTACH_HEALTH_CHECK = "AppAttachHealthCheck" """Verifies that the AppAttachService is healthy (there were no issues during package staging). - #: The AppAttachService is used to enable the staging/registration (and eventual - #: deregistration/destaging) of MSIX apps that have been set up by the tenant admin. This checks - #: whether the component had any failures during package staging. Failures in staging will prevent - #: some MSIX apps from working properly for the end user. If this check fails, it is non fatal and - #: the machine still can service connections, main issue may be certain apps will not work for - #: end-users. (Currently Enabled)""" + The AppAttachService is used to enable the staging/registration (and eventual + deregistration/destaging) of MSIX apps that have been set up by the tenant admin. This checks + whether the component had any failures during package staging. Failures in staging will prevent + some MSIX apps from working properly for the end user. If this check fails, it is non fatal and + the machine still can service connections, main issue may be certain apps will not work for + end-users. (Currently Enabled)""" class HealthCheckResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -142,13 +162,13 @@ class HostPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): PERSONAL = "Personal" """Users will be assigned a SessionHost either by administrators (PersonalDesktopAssignmentType = - #: Direct) or upon connecting to the pool (PersonalDesktopAssignmentType = Automatic). They will - #: always be redirected to their assigned SessionHost.""" + Direct) or upon connecting to the pool (PersonalDesktopAssignmentType = Automatic). They will + always be redirected to their assigned SessionHost.""" POOLED = "Pooled" """Users get a new (random) SessionHost every time it connects to the HostPool.""" BYO_DESKTOP = "BYODesktop" """Users assign their own machines, load balancing logic remains the same as Personal. - #: PersonalDesktopAssignmentType must be Direct.""" + PersonalDesktopAssignmentType must be Direct.""" class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -159,6 +179,13 @@ class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): PERSISTENT = "Persistent" +class PackageTimestamped(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Is package timestamped so it can ignore the certificate expiry date.""" + + TIMESTAMPED = "Timestamped" + NOT_TIMESTAMPED = "NotTimestamped" + + class PersonalDesktopAssignmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """PersonalDesktopAssignment type for HostPool.""" @@ -191,6 +218,15 @@ class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiv REJECTED = "Rejected" +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + PROVISIONING = "Provisioning" + FAILED = "Failed" + CANCELED = "Canceled" + + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. @@ -304,7 +340,7 @@ class StartupBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" """Session hosts will not be started by the service. This setting depends on Start VM on Connect - #: to be enabled to start the session hosts.""" + to be enabled to start the session hosts.""" WITH_ASSIGNED_USER = "WithAssignedUser" """Session hosts with an assigned user will be started during Ramp Up""" ALL = "All" @@ -318,19 +354,19 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Session Host has passed all the health checks and is available to handle connections.""" UNAVAILABLE = "Unavailable" """Session Host is either turned off or has failed critical health checks which is causing service - #: not to be able to route connections to this session host. Note this replaces previous - #: 'NoHeartBeat' status.""" + not to be able to route connections to this session host. Note this replaces previous + 'NoHeartBeat' status.""" SHUTDOWN = "Shutdown" """Session Host is shutdown - RD Agent reported session host to be stopped or deallocated.""" DISCONNECTED = "Disconnected" """The Session Host is unavailable because it is currently disconnected.""" UPGRADING = "Upgrading" """Session Host is unavailable because currently an upgrade of RDAgent/side-by-side stack is in - #: progress. Note: this state will be removed once the upgrade completes and the host is able to - #: accept connections.""" + progress. Note: this state will be removed once the upgrade completes and the host is able to + accept connections.""" UPGRADE_FAILED = "UpgradeFailed" """Session Host is unavailable because the critical component upgrade (agent, side-by-side stack, - #: etc.) failed.""" + etc.) failed.""" NO_HEARTBEAT = "NoHeartbeat" """The Session Host is not heart beating.""" NOT_JOINED_TO_DOMAIN = "NotJoinedToDomain" @@ -343,7 +379,7 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): """FSLogix is in an unhealthy state on the session host.""" NEEDS_ASSISTANCE = "NeedsAssistance" """New status to inform admins that the health on their endpoint needs to be fixed. The - #: connections might not fail, as these issues are not fatal.""" + connections might not fail, as these issues are not fatal.""" class StopHostsWhen(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py index f410efbcb55b..ed0573f79a82 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py @@ -8,16 +8,10 @@ # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -138,26 +132,31 @@ class Resource(_serialization.Model): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } def __init__(self, **kwargs: Any) -> None: @@ -166,6 +165,457 @@ def __init__(self, **kwargs: Any) -> None: self.id = None self.name = None self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class AppAttachPackage(TrackedResource): + """Schema for App Attach Package properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.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: Detailed properties for App Attach Package. Required. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "AppAttachPackageProperties"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.AppAttachPackageProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Detailed properties for App Attach Package. Required. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class AppAttachPackageInfoProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Schema for Import Package Information properties. + + :ivar package_alias: Alias of App Attach Package. Assigned at import time. + :vartype package_alias: str + :ivar image_path: VHD/CIM image path on Network Share. + :vartype image_path: str + :ivar package_name: Package Name from appxmanifest.xml. + :vartype package_name: str + :ivar package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name and + Publisher name. + :vartype package_family_name: str + :ivar package_full_name: Package Full Name from appxmanifest.xml. + :vartype package_full_name: str + :ivar display_name: User friendly Name to be displayed in the portal. + :vartype display_name: str + :ivar package_relative_path: Relative Path to the package inside the image. + :vartype package_relative_path: str + :ivar is_regular_registration: Specifies how to register Package in feed. + :vartype is_regular_registration: bool + :ivar is_active: Make this version of the package the active one across the hostpool. + :vartype is_active: bool + :ivar package_dependencies: List of package dependencies. + :vartype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :ivar version: Package version found in the appxmanifest.xml. + :vartype version: str + :ivar last_updated: Date Package was last updated, found in the appxmanifest.xml. + :vartype last_updated: ~datetime.datetime + :ivar package_applications: List of package applications. + :vartype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :ivar certificate_name: Certificate name found in the appxmanifest.xml. + :vartype certificate_name: str + :ivar certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :vartype certificate_expiry: ~datetime.datetime + :ivar is_package_timestamped: Is package timestamped so it can ignore the certificate expiry + date. Known values are: "Timestamped" and "NotTimestamped". + :vartype is_package_timestamped: str or + ~azure.mgmt.desktopvirtualization.models.PackageTimestamped + """ + + _attribute_map = { + "package_alias": {"key": "packageAlias", "type": "str"}, + "image_path": {"key": "imagePath", "type": "str"}, + "package_name": {"key": "packageName", "type": "str"}, + "package_family_name": {"key": "packageFamilyName", "type": "str"}, + "package_full_name": {"key": "packageFullName", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "package_relative_path": {"key": "packageRelativePath", "type": "str"}, + "is_regular_registration": {"key": "isRegularRegistration", "type": "bool"}, + "is_active": {"key": "isActive", "type": "bool"}, + "package_dependencies": {"key": "packageDependencies", "type": "[MsixPackageDependencies]"}, + "version": {"key": "version", "type": "str"}, + "last_updated": {"key": "lastUpdated", "type": "iso-8601"}, + "package_applications": {"key": "packageApplications", "type": "[MsixPackageApplications]"}, + "certificate_name": {"key": "certificateName", "type": "str"}, + "certificate_expiry": {"key": "certificateExpiry", "type": "iso-8601"}, + "is_package_timestamped": {"key": "isPackageTimestamped", "type": "str"}, + } + + def __init__( + self, + *, + package_alias: Optional[str] = None, + image_path: Optional[str] = None, + package_name: Optional[str] = None, + package_family_name: Optional[str] = None, + package_full_name: Optional[str] = None, + display_name: Optional[str] = None, + package_relative_path: Optional[str] = None, + is_regular_registration: Optional[bool] = None, + is_active: Optional[bool] = None, + package_dependencies: Optional[List["_models.MsixPackageDependencies"]] = None, + version: Optional[str] = None, + last_updated: Optional[datetime.datetime] = None, + package_applications: Optional[List["_models.MsixPackageApplications"]] = None, + certificate_name: Optional[str] = None, + certificate_expiry: Optional[datetime.datetime] = None, + is_package_timestamped: Optional[Union[str, "_models.PackageTimestamped"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword package_alias: Alias of App Attach Package. Assigned at import time. + :paramtype package_alias: str + :keyword image_path: VHD/CIM image path on Network Share. + :paramtype image_path: str + :keyword package_name: Package Name from appxmanifest.xml. + :paramtype package_name: str + :keyword package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name + and Publisher name. + :paramtype package_family_name: str + :keyword package_full_name: Package Full Name from appxmanifest.xml. + :paramtype package_full_name: str + :keyword display_name: User friendly Name to be displayed in the portal. + :paramtype display_name: str + :keyword package_relative_path: Relative Path to the package inside the image. + :paramtype package_relative_path: str + :keyword is_regular_registration: Specifies how to register Package in feed. + :paramtype is_regular_registration: bool + :keyword is_active: Make this version of the package the active one across the hostpool. + :paramtype is_active: bool + :keyword package_dependencies: List of package dependencies. + :paramtype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :keyword version: Package version found in the appxmanifest.xml. + :paramtype version: str + :keyword last_updated: Date Package was last updated, found in the appxmanifest.xml. + :paramtype last_updated: ~datetime.datetime + :keyword package_applications: List of package applications. + :paramtype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :keyword certificate_name: Certificate name found in the appxmanifest.xml. + :paramtype certificate_name: str + :keyword certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :paramtype certificate_expiry: ~datetime.datetime + :keyword is_package_timestamped: Is package timestamped so it can ignore the certificate expiry + date. Known values are: "Timestamped" and "NotTimestamped". + :paramtype is_package_timestamped: str or + ~azure.mgmt.desktopvirtualization.models.PackageTimestamped + """ + super().__init__(**kwargs) + self.package_alias = package_alias + self.image_path = image_path + self.package_name = package_name + self.package_family_name = package_family_name + self.package_full_name = package_full_name + self.display_name = display_name + self.package_relative_path = package_relative_path + self.is_regular_registration = is_regular_registration + self.is_active = is_active + self.package_dependencies = package_dependencies + self.version = version + self.last_updated = last_updated + self.package_applications = package_applications + self.certificate_name = certificate_name + self.certificate_expiry = certificate_expiry + self.is_package_timestamped = is_package_timestamped + + +class AppAttachPackageList(_serialization.Model): + """List of App Attach Package definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of App Attach Package definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AppAttachPackage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.AppAttachPackage"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of App Attach Package definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AppAttachPackagePatch(Resource): + """Schema for updatable App Attach Package properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData + :ivar properties: Detailed properties for App Attach Package. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatchProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "AppAttachPackagePatchProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.AppAttachPackagePatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Detailed properties for App Attach Package. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatchProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AppAttachPackagePatchProperties(_serialization.Model): + """Schema for patchable fields on an App Attach Package. + + :ivar image: Detailed properties for App Attach Package. + :vartype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :ivar host_pool_references: List of Hostpool resource Ids. + :vartype host_pool_references: list[str] + :ivar key_vault_url: URL path to certificate name located in keyVault. + :vartype key_vault_url: str + :ivar fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :vartype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + """ + + _attribute_map = { + "image": {"key": "image", "type": "AppAttachPackageInfoProperties"}, + "host_pool_references": {"key": "hostPoolReferences", "type": "[str]"}, + "key_vault_url": {"key": "keyVaultURL", "type": "str"}, + "fail_health_check_on_staging_failure": {"key": "failHealthCheckOnStagingFailure", "type": "str"}, + } + + def __init__( + self, + *, + image: Optional["_models.AppAttachPackageInfoProperties"] = None, + host_pool_references: Optional[List[str]] = None, + key_vault_url: Optional[str] = None, + fail_health_check_on_staging_failure: Optional[Union[str, "_models.FailHealthCheckOnStagingFailure"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword image: Detailed properties for App Attach Package. + :paramtype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :keyword host_pool_references: List of Hostpool resource Ids. + :paramtype host_pool_references: list[str] + :keyword key_vault_url: URL path to certificate name located in keyVault. + :paramtype key_vault_url: str + :keyword fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :paramtype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + """ + super().__init__(**kwargs) + self.image = image + self.host_pool_references = host_pool_references + self.key_vault_url = key_vault_url + self.fail_health_check_on_staging_failure = fail_health_check_on_staging_failure + + +class AppAttachPackageProperties(_serialization.Model): + """Schema for App Attach Package properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the App Attach Package. Known values are: + "Succeeded", "Provisioning", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.desktopvirtualization.models.ProvisioningState + :ivar image: Detailed properties for App Attach Package. + :vartype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :ivar host_pool_references: List of Hostpool resource Ids. + :vartype host_pool_references: list[str] + :ivar key_vault_url: URL path to certificate name located in keyVault. + :vartype key_vault_url: str + :ivar fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :vartype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "image": {"key": "image", "type": "AppAttachPackageInfoProperties"}, + "host_pool_references": {"key": "hostPoolReferences", "type": "[str]"}, + "key_vault_url": {"key": "keyVaultURL", "type": "str"}, + "fail_health_check_on_staging_failure": {"key": "failHealthCheckOnStagingFailure", "type": "str"}, + } + + def __init__( + self, + *, + image: Optional["_models.AppAttachPackageInfoProperties"] = None, + host_pool_references: Optional[List[str]] = None, + key_vault_url: Optional[str] = None, + fail_health_check_on_staging_failure: Optional[Union[str, "_models.FailHealthCheckOnStagingFailure"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword image: Detailed properties for App Attach Package. + :paramtype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :keyword host_pool_references: List of Hostpool resource Ids. + :paramtype host_pool_references: list[str] + :keyword key_vault_url: URL path to certificate name located in keyVault. + :paramtype key_vault_url: str + :keyword fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :paramtype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.image = image + self.host_pool_references = host_pool_references + self.key_vault_url = key_vault_url + self.fail_health_check_on_staging_failure = fail_health_check_on_staging_failure class Application(Resource): # pylint: disable=too-many-instance-attributes @@ -173,17 +623,18 @@ class Application(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of Application. (internal use). :vartype object_id: str @@ -303,7 +754,6 @@ def __init__( :paramtype icon_index: int """ super().__init__(**kwargs) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name @@ -320,21 +770,28 @@ def __init__( self.icon_content = None -class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ResourceModelWithAllowedPropertySet(TrackedResource): # pylint: disable=too-many-instance-attributes """The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. 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}. + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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 location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -342,7 +799,7 @@ class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disa managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -351,8 +808,6 @@ class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disa the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] :ivar identity: :vartype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -366,6 +821,8 @@ class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disa "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, } @@ -374,11 +831,12 @@ class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disa "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, @@ -387,17 +845,19 @@ class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disa def __init__( self, *, - location: Optional[str] = None, + location: str, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -405,11 +865,9 @@ def __init__( it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] :keyword identity: :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -419,15 +877,10 @@ def __init__( :paramtype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location + super().__init__(tags=tags, location=location, **kwargs) self.managed_by = managed_by self.kind = kind self.etag = None - self.tags = tags self.identity = identity self.sku = sku self.plan = plan @@ -438,17 +891,22 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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 location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -456,7 +914,7 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -465,8 +923,6 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] :ivar identity: :vartype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -474,8 +930,6 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku :ivar plan: :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of ApplicationGroup. (internal use). :vartype object_id: str :ivar description: Description of ApplicationGroup. @@ -500,9 +954,10 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, - "system_data": {"readonly": True}, "object_id": {"readonly": True}, "host_pool_arm_path": {"required": True}, "workspace_arm_path": {"readonly": True}, @@ -514,15 +969,15 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -536,12 +991,12 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= def __init__( self, *, + location: str, host_pool_arm_path: str, application_group_type: Union[str, "_models.ApplicationGroupType"], - location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, @@ -551,7 +1006,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -559,11 +1016,9 @@ def __init__( it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] :keyword identity: :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -586,16 +1041,15 @@ def __init__( :paramtype show_in_feed: bool """ super().__init__( + tags=tags, location=location, managed_by=managed_by, kind=kind, - tags=tags, identity=identity, sku=sku, plan=plan, **kwargs ) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name @@ -641,14 +1095,17 @@ class ApplicationGroupPatch(Resource): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData :ivar tags: tags to be updated. :vartype tags: dict[str, str] :ivar description: Description of ApplicationGroup. @@ -663,12 +1120,14 @@ class ApplicationGroupPatch(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -879,15 +1338,16 @@ class Desktop(Resource): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of Desktop. (internal use). :vartype object_id: str @@ -933,7 +1393,6 @@ def __init__( :paramtype friendly_name: str """ super().__init__(**kwargs) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name @@ -1010,19 +1469,114 @@ def __init__( self.friendly_name = friendly_name +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + 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.desktopvirtualization.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.desktopvirtualization.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes """Represents the definition of contents retrieved after expanding the MSIX Image. 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData :ivar package_alias: Alias of MSIX Package. :vartype package_alias: str :ivar image_path: VHD/CIM image path on Network Share. @@ -1045,25 +1599,31 @@ class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes :ivar package_dependencies: List of package dependencies. :vartype package_dependencies: list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] - :ivar version: Package Version found in the appxmanifest.xml. + :ivar version: Package version found in the appxmanifest.xml. :vartype version: str :ivar last_updated: Date Package was last updated, found in the appxmanifest.xml. :vartype last_updated: ~datetime.datetime :ivar package_applications: List of package applications. :vartype package_applications: list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :ivar certificate_name: Certificate name found in the appxmanifest.xml. + :vartype certificate_name: str + :ivar certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :vartype certificate_expiry: ~datetime.datetime """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "package_alias": {"key": "properties.packageAlias", "type": "str"}, "image_path": {"key": "properties.imagePath", "type": "str"}, "package_name": {"key": "properties.packageName", "type": "str"}, @@ -1077,6 +1637,8 @@ class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes "version": {"key": "properties.version", "type": "str"}, "last_updated": {"key": "properties.lastUpdated", "type": "iso-8601"}, "package_applications": {"key": "properties.packageApplications", "type": "[MsixPackageApplications]"}, + "certificate_name": {"key": "properties.certificateName", "type": "str"}, + "certificate_expiry": {"key": "properties.certificateExpiry", "type": "iso-8601"}, } def __init__( @@ -1095,6 +1657,8 @@ def __init__( version: Optional[str] = None, last_updated: Optional[datetime.datetime] = None, package_applications: Optional[List["_models.MsixPackageApplications"]] = None, + certificate_name: Optional[str] = None, + certificate_expiry: Optional[datetime.datetime] = None, **kwargs: Any ) -> None: """ @@ -1120,13 +1684,17 @@ def __init__( :keyword package_dependencies: List of package dependencies. :paramtype package_dependencies: list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] - :keyword version: Package Version found in the appxmanifest.xml. + :keyword version: Package version found in the appxmanifest.xml. :paramtype version: str :keyword last_updated: Date Package was last updated, found in the appxmanifest.xml. :paramtype last_updated: ~datetime.datetime :keyword package_applications: List of package applications. :paramtype package_applications: list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :keyword certificate_name: Certificate name found in the appxmanifest.xml. + :paramtype certificate_name: str + :keyword certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :paramtype certificate_expiry: ~datetime.datetime """ super().__init__(**kwargs) self.package_alias = package_alias @@ -1142,6 +1710,8 @@ def __init__( self.version = version self.last_updated = last_updated self.package_applications = package_applications + self.certificate_name = certificate_name + self.certificate_expiry = certificate_expiry class ExpandMsixImageList(_serialization.Model): @@ -1179,17 +1749,22 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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 location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -1197,7 +1772,7 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -1206,8 +1781,6 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] :ivar identity: :vartype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -1215,8 +1788,6 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku :ivar plan: :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of HostPool. (internal use). :vartype object_id: str :ivar friendly_name: Friendly name of HostPool. @@ -1247,6 +1818,8 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many :vartype vm_template: str :ivar application_group_references: List of applicationGroup links. :vartype application_group_references: list[str] + :ivar app_attach_package_references: List of App Attach Package links. + :vartype app_attach_package_references: list[str] :ivar ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. :vartype ssoadfs_authority: str :ivar sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO @@ -1286,13 +1859,15 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, - "system_data": {"readonly": True}, "object_id": {"readonly": True}, "host_pool_type": {"required": True}, "load_balancer_type": {"required": True}, "application_group_references": {"readonly": True}, + "app_attach_package_references": {"readonly": True}, "preferred_app_group_type": {"required": True}, "cloud_pc_resource": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, @@ -1302,15 +1877,15 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "object_id": {"key": "properties.objectId", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, @@ -1324,6 +1899,7 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "registration_info": {"key": "properties.registrationInfo", "type": "RegistrationInfo"}, "vm_template": {"key": "properties.vmTemplate", "type": "str"}, "application_group_references": {"key": "properties.applicationGroupReferences", "type": "[str]"}, + "app_attach_package_references": {"key": "properties.appAttachPackageReferences", "type": "[str]"}, "ssoadfs_authority": {"key": "properties.ssoadfsAuthority", "type": "str"}, "sso_client_id": {"key": "properties.ssoClientId", "type": "str"}, "sso_client_secret_key_vault_path": {"key": "properties.ssoClientSecretKeyVaultPath", "type": "str"}, @@ -1342,13 +1918,13 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many def __init__( # pylint: disable=too-many-locals self, *, + location: str, host_pool_type: Union[str, "_models.HostPoolType"], load_balancer_type: Union[str, "_models.LoadBalancerType"], preferred_app_group_type: Union[str, "_models.PreferredAppGroupType"], - location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, @@ -1371,7 +1947,9 @@ def __init__( # pylint: disable=too-many-locals **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -1379,11 +1957,9 @@ def __init__( # pylint: disable=too-many-locals it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] :keyword identity: :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -1447,16 +2023,15 @@ def __init__( # pylint: disable=too-many-locals :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdateProperties """ super().__init__( + tags=tags, location=location, managed_by=managed_by, kind=kind, - tags=tags, identity=identity, sku=sku, plan=plan, **kwargs ) - self.system_data = None self.object_id = None self.friendly_name = friendly_name self.description = description @@ -1470,6 +2045,7 @@ def __init__( # pylint: disable=too-many-locals self.registration_info = registration_info self.vm_template = vm_template self.application_group_references = None + self.app_attach_package_references = None self.ssoadfs_authority = ssoadfs_authority self.sso_client_id = sso_client_id self.sso_client_secret_key_vault_path = sso_client_secret_key_vault_path @@ -1517,14 +2093,17 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData :ivar tags: tags to be updated. :vartype tags: dict[str, str] :ivar friendly_name: Friendly name of HostPool. @@ -1581,12 +2160,14 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, @@ -1711,9 +2292,9 @@ class Identity(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal ID of resource identity. + :ivar principal_id: The principal ID of resource identity. The value must be an UUID. :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. + :ivar tenant_id: The tenant ID of resource. The value must be an UUID. :vartype tenant_id: str :ivar type: The identity type. Default value is "SystemAssigned". :vartype type: str @@ -1741,6 +2322,42 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs self.type = type +class ImportPackageInfoRequest(_serialization.Model): + """Information to import app attach package. + + :ivar path: URI to Image. + :vartype path: str + :ivar package_architecture: Possible device architectures that an app attach package can be + configured for. Known values are: "ARM", "ARM64", "x86", "x64", "Neutral", "x86a64", and "ALL". + :vartype package_architecture: str or + ~azure.mgmt.desktopvirtualization.models.AppAttachPackageArchitectures + """ + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + "package_architecture": {"key": "packageArchitecture", "type": "str"}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + package_architecture: Optional[Union[str, "_models.AppAttachPackageArchitectures"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword path: URI to Image. + :paramtype path: str + :keyword package_architecture: Possible device architectures that an app attach package can be + configured for. Known values are: "ARM", "ARM64", "x86", "x64", "Neutral", "x86a64", and "ALL". + :paramtype package_architecture: str or + ~azure.mgmt.desktopvirtualization.models.AppAttachPackageArchitectures + """ + super().__init__(**kwargs) + self.path = path + self.package_architecture = package_architecture + + class LogSpecification(_serialization.Model): """Specifications of the Log for Azure Monitoring. @@ -1873,15 +2490,16 @@ class MSIXPackage(Resource): # pylint: disable=too-many-instance-attributes 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar image_path: VHD/CIM image path on Network Share. :vartype image_path: str @@ -1901,7 +2519,7 @@ class MSIXPackage(Resource): # pylint: disable=too-many-instance-attributes :ivar package_dependencies: List of package dependencies. :vartype package_dependencies: list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] - :ivar version: Package Version found in the appxmanifest.xml. + :ivar version: Package version found in the appxmanifest.xml. :vartype version: str :ivar last_updated: Date Package was last updated, found in the appxmanifest.xml. :vartype last_updated: ~datetime.datetime @@ -1970,7 +2588,7 @@ def __init__( :keyword package_dependencies: List of package dependencies. :paramtype package_dependencies: list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] - :keyword version: Package Version found in the appxmanifest.xml. + :keyword version: Package version found in the appxmanifest.xml. :paramtype version: str :keyword last_updated: Date Package was last updated, found in the appxmanifest.xml. :paramtype last_updated: ~datetime.datetime @@ -1979,7 +2597,6 @@ def __init__( list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] """ super().__init__(**kwargs) - self.system_data = None self.image_path = image_path self.package_name = package_name self.package_family_name = package_family_name @@ -2136,14 +2753,17 @@ class MSIXPackagePatch(Resource): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData :ivar is_active: Set a version of the package to be active across hostpool. :vartype is_active: bool :ivar is_regular_registration: Set Registration mode. Regular or Delayed. @@ -2156,12 +2776,14 @@ class MSIXPackagePatch(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "is_active": {"key": "properties.isActive", "type": "bool"}, "is_regular_registration": {"key": "properties.isRegularRegistration", "type": "bool"}, "display_name": {"key": "properties.displayName", "type": "str"}, @@ -2214,7 +2836,7 @@ def __init__( class Plan(_serialization.Model): """Plan for the resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required. :vartype name: str @@ -2279,11 +2901,11 @@ def __init__( class PrivateEndpoint(_serialization.Model): - """The Private Endpoint resource. + """The private endpoint resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ARM identifier for Private Endpoint. + :ivar id: The ARM identifier for private endpoint. :vartype id: str """ @@ -2302,19 +2924,24 @@ def __init__(self, **kwargs: Any) -> None: class PrivateEndpointConnection(Resource): - """The Private Endpoint Connection resource. + """The private endpoint connection resource. 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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 private_endpoint: The resource of private end point. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The private endpoint resource. :vartype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint :ivar private_link_service_connection_state: A collection of information about the state of the connection between service consumer and provider. @@ -2330,6 +2957,8 @@ class PrivateEndpointConnection(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "group_ids": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -2337,6 +2966,8 @@ class PrivateEndpointConnection(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "group_ids": {"key": "properties.groupIds", "type": "[str]"}, "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, "private_link_service_connection_state": { "key": "properties.privateLinkServiceConnectionState", @@ -2353,7 +2984,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword private_endpoint: The resource of private end point. + :keyword private_endpoint: The private endpoint resource. :paramtype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint :keyword private_link_service_connection_state: A collection of information about the state of the connection between service consumer and provider. @@ -2361,12 +2992,13 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) + self.group_ids = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None -class PrivateEndpointConnectionListResultWithSystemData(_serialization.Model): +class PrivateEndpointConnectionListResultWithSystemData(_serialization.Model): # pylint: disable=name-too-long """List of private endpoint connection associated with the specified storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -2405,15 +3037,20 @@ class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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 private_endpoint: The resource of private end point. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The private endpoint resource. :vartype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint :ivar private_link_service_connection_state: A collection of information about the state of the connection between service consumer and provider. @@ -2423,67 +3060,25 @@ class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): Known values are: "Succeeded", "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProvisioningState - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState - """ - super().__init__( - private_endpoint=private_endpoint, - private_link_service_connection_state=private_link_service_connection_state, - **kwargs - ) - self.system_data = None - class PrivateLinkResource(Resource): """A private link resource. 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData :ivar group_id: The private link resource group id. :vartype group_id: str :ivar required_members: The private link resource required member names. @@ -2496,6 +3091,7 @@ class PrivateLinkResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "group_id": {"readonly": True}, "required_members": {"readonly": True}, } @@ -2504,6 +3100,7 @@ class PrivateLinkResource(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "group_id": {"key": "properties.groupId", "type": "str"}, "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, @@ -2602,32 +3199,19 @@ class ProxyResource(Resource): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class RegistrationInfo(_serialization.Model): """Represents a RegistrationInfo definition. @@ -2708,42 +3292,24 @@ def __init__( self.registration_token_operation = registration_token_operation -class ResourceModelWithAllowedPropertySetIdentity(Identity): +class ResourceModelWithAllowedPropertySetIdentity(Identity): # pylint: disable=name-too-long """ResourceModelWithAllowedPropertySetIdentity. Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal ID of resource identity. + :ivar principal_id: The principal ID of resource identity. The value must be an UUID. :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. + :ivar tenant_id: The tenant ID of resource. The value must be an UUID. :vartype tenant_id: str :ivar type: The identity type. Default value is "SystemAssigned". :vartype type: str """ - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: - """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str - """ - super().__init__(type=type, **kwargs) - class ResourceModelWithAllowedPropertySetPlan(Plan): """ResourceModelWithAllowedPropertySetPlan. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required. :vartype name: str @@ -2760,56 +3326,13 @@ class ResourceModelWithAllowedPropertySetPlan(Plan): :vartype version: str """ - _validation = { - "name": {"required": True}, - "publisher": {"required": True}, - "product": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - "promotion_code": {"key": "promotionCode", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - publisher: str, - product: str, - promotion_code: Optional[str] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: A user defined name of the 3rd Party Artifact that is being procured. Required. - :paramtype name: str - :keyword publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. - NewRelic. Required. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to - the OfferID specified for the artifact at the time of Data Market onboarding. Required. - :paramtype product: str - :keyword promotion_code: A publisher provided promotion code as provisioned in Data Market for - the said product/artifact. - :paramtype promotion_code: str - :keyword version: The version of the desired product/artifact. - :paramtype version: str - """ - super().__init__( - name=name, publisher=publisher, product=product, promotion_code=promotion_code, version=version, **kwargs - ) - class Sku(_serialization.Model): """The resource model definition representing SKU. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. + :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. :vartype name: str :ivar tier: This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", @@ -2849,7 +3372,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. + :keyword name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. :paramtype name: str :keyword tier: This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", @@ -2876,9 +3399,9 @@ def __init__( class ResourceModelWithAllowedPropertySetSku(Sku): """ResourceModelWithAllowedPropertySetSku. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. + :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. :vartype name: str :ivar tier: This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", @@ -2895,47 +3418,6 @@ class ResourceModelWithAllowedPropertySetSku(Sku): :vartype capacity: int """ - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - tier: Optional[Union[str, "_models.SkuTier"]] = None, - size: Optional[str] = None, - family: Optional[str] = None, - capacity: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :paramtype name: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :paramtype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: int - """ - super().__init__(name=name, tier=tier, size=size, family=family, capacity=capacity, **kwargs) - class ResourceProviderOperation(_serialization.Model): """Supported operation of this resource provider. @@ -3092,17 +3574,22 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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 location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -3110,7 +3597,7 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -3119,8 +3606,6 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] :ivar identity: :vartype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -3128,8 +3613,6 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku :ivar plan: :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of scaling plan. (internal use). :vartype object_id: str :ivar description: Description of scaling plan. @@ -3153,9 +3636,10 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, - "system_data": {"readonly": True}, "object_id": {"readonly": True}, "time_zone": {"required": True}, } @@ -3164,15 +3648,15 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -3186,11 +3670,11 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m def __init__( self, *, + location: str, time_zone: str, - location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, @@ -3203,7 +3687,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -3211,11 +3697,9 @@ def __init__( it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] :keyword identity: :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -3241,16 +3725,15 @@ def __init__( list[~azure.mgmt.desktopvirtualization.models.ScalingHostPoolReference] """ super().__init__( + tags=tags, location=location, managed_by=managed_by, kind=kind, - tags=tags, identity=identity, sku=sku, plan=plan, **kwargs ) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name @@ -3365,15 +3848,16 @@ class ScalingPlanPersonalSchedule(ProxyResource): # pylint: disable=too-many-in 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar days_of_week: Set of days of the week on which this schedule is active. :vartype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] @@ -3636,7 +4120,6 @@ def __init__( # pylint: disable=too-many-locals :paramtype off_peak_minutes_to_wait_on_logoff: int """ super().__init__(**kwargs) - self.system_data = None self.days_of_week = days_of_week self.ramp_up_start_time = ramp_up_start_time self.ramp_up_auto_start_hosts = ramp_up_auto_start_hosts @@ -3984,15 +4467,16 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar days_of_week: Set of days of the week on which this schedule is active. :vartype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] @@ -4147,7 +4631,6 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm """ super().__init__(**kwargs) - self.system_data = None self.days_of_week = days_of_week self.ramp_up_start_time = ramp_up_start_time self.ramp_up_load_balancing_algorithm = ramp_up_load_balancing_algorithm @@ -4202,14 +4685,17 @@ class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-inst 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData :ivar days_of_week: Set of days of the week on which this schedule is active. :vartype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] :ivar ramp_up_start_time: Starting time for ramp up period. @@ -4261,6 +4747,7 @@ class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-inst "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "ramp_up_minimum_hosts_pct": {"maximum": 100, "minimum": 0}, "ramp_up_capacity_threshold_pct": {"maximum": 100, "minimum": 1}, "ramp_down_minimum_hosts_pct": {"maximum": 100, "minimum": 0}, @@ -4271,6 +4758,7 @@ class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-inst "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "days_of_week": {"key": "properties.daysOfWeek", "type": "[str]"}, "ramp_up_start_time": {"key": "properties.rampUpStartTime", "type": "Time"}, "ramp_up_load_balancing_algorithm": {"key": "properties.rampUpLoadBalancingAlgorithm", "type": "str"}, @@ -4609,15 +5097,16 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of SessionHost. (internal use). :vartype object_id: str @@ -4745,7 +5234,6 @@ def __init__( :paramtype update_error_message: str """ super().__init__(**kwargs) - self.system_data = None self.object_id = None self.last_heart_beat = last_heart_beat self.sessions = sessions @@ -4875,14 +5363,17 @@ class SessionHostPatch(Resource): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData :ivar allow_new_session: Allow a new session. :vartype allow_new_session: bool :ivar assigned_user: User assigned to SessionHost. @@ -4895,12 +5386,14 @@ class SessionHostPatch(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "allow_new_session": {"key": "properties.allowNewSession", "type": "bool"}, "assigned_user": {"key": "properties.assignedUser", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -4933,14 +5426,17 @@ class StartMenuItem(Resource): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.desktopvirtualization.models.SystemData :ivar app_alias: Alias of StartMenuItem. :vartype app_alias: str :ivar file_path: Path to the file of StartMenuItem. @@ -4957,12 +5453,14 @@ class StartMenuItem(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "app_alias": {"key": "properties.appAlias", "type": "str"}, "file_path": {"key": "properties.filePath", "type": "str"}, "command_line_arguments": {"key": "properties.commandLineArguments", "type": "str"}, @@ -5097,7 +5595,7 @@ def __init__( class Time(_serialization.Model): """The time for a scaling action to occur. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar hour: The hour. Required. :vartype hour: int @@ -5132,15 +5630,16 @@ class UserSession(Resource): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of user session. (internal use). :vartype object_id: str @@ -5204,7 +5703,6 @@ def __init__( :paramtype create_time: ~datetime.datetime """ super().__init__(**kwargs) - self.system_data = None self.object_id = None self.user_principal_name = user_principal_name self.application_type = application_type @@ -5248,15 +5746,22 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man 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}. + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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 location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -5264,7 +5769,7 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -5273,8 +5778,6 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] :ivar identity: :vartype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -5282,8 +5785,6 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku :ivar plan: :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of Workspace. (internal use). :vartype object_id: str :ivar description: Description of Workspace. @@ -5309,9 +5810,10 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, - "system_data": {"readonly": True}, "object_id": {"readonly": True}, "cloud_pc_resource": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, @@ -5321,15 +5823,15 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -5345,10 +5847,10 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man def __init__( self, *, - location: Optional[str] = None, + location: str, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, @@ -5359,7 +5861,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -5367,11 +5871,9 @@ def __init__( it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] :keyword identity: :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity @@ -5393,16 +5895,15 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.PublicNetworkAccess """ super().__init__( + tags=tags, location=location, managed_by=managed_by, kind=kind, - tags=tags, identity=identity, sku=sku, plan=plan, **kwargs ) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py index 975df17adf61..df927dd95440 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py @@ -21,7 +21,9 @@ from ._user_sessions_operations import UserSessionsOperations from ._session_hosts_operations import SessionHostsOperations from ._msix_packages_operations import MSIXPackagesOperations +from ._app_attach_package_info_operations import AppAttachPackageInfoOperations from ._msix_images_operations import MsixImagesOperations +from ._app_attach_package_operations import AppAttachPackageOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -43,7 +45,9 @@ "UserSessionsOperations", "SessionHostsOperations", "MSIXPackagesOperations", + "AppAttachPackageInfoOperations", "MsixImagesOperations", + "AppAttachPackageOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py new file mode 100644 index 000000000000..401a6ea4c285 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py @@ -0,0 +1,257 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_import_method_request( + resource_group_name: str, host_pool_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-04-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/importAppAttachPackageInfo", + ) # 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", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AppAttachPackageInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package_info` attribute. + """ + + models = _models + + 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") + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: _models.ImportPackageInfoRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: 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 iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: Union[_models.ImportPackageInfoRequest, IO[bytes]], + **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Is either a ImportPackageInfoRequest type or a IO[bytes] type. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest or IO[bytes] + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(import_package_info_request, (IOBase, bytes)): + _content = import_package_info_request + else: + _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + + def prepare_request(next_link=None): + if not next_link: + + _request = build_import_method_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py new file mode 100644 index 000000000000..8037ae29e6f9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py @@ -0,0 +1,842 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, app_attach_package_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-04-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # 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", max_length=90, min_length=1 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$", + ), + } + + _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_create_or_update_request( + resource_group_name: str, app_attach_package_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-04-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # 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", max_length=90, min_length=1 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$", + ), + } + + _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_delete_request( + resource_group_name: str, app_attach_package_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-04-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # 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", max_length=90, min_length=1 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$", + ), + } + + _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_update_request( + resource_group_name: str, app_attach_package_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-04-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # 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", max_length=90, min_length=1 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$", + ), + } + + _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_list_by_resource_group_request( + resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **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-04-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages", + ) # 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", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request( + subscription_id: str, *, filter: Optional[str] = None, **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-04-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages" + ) # pylint: disable=line-too-long + 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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AppAttachPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any) -> _models.AppAttachPackage: + """Get an app attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppAttachPackage] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: _models.AppAttachPackage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: 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: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: Union[_models.AppAttachPackage, IO[bytes]], + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Is either a + AppAttachPackage type or a IO[bytes] type. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage or + IO[bytes] + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package, (IOBase, bytes)): + _content = app_attach_package + else: + _json = self._serialize.body(app_attach_package, "AppAttachPackage") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any + ) -> None: + """Remove an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[_models.AppAttachPackagePatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: 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: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[Union[_models.AppAttachPackagePatch, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Is either a + AppAttachPackagePatch type or a IO[bytes] type. Default value is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + or IO[bytes] + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package_patch, (IOBase, bytes)): + _content = app_attach_package_patch + else: + if app_attach_package_patch is not None: + _json = self._serialize.body(app_attach_package_patch, "AppAttachPackagePatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """List App Attach packages in resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param filter: OData filter expression. Valid properties for filtering are package name and + host pool. Default value is None. + :type filter: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map = { + 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_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AppAttachPackage"]: + """List App Attach packages in subscription. + + :param filter: OData filter expression. Valid properties for filtering are package name, host + pool, and resource group. Default value is None. + :type filter: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map = { + 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_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py index e4da88807cbf..a111e2801d18 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,12 +52,17 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -78,7 +83,7 @@ def build_create_or_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -88,12 +93,17 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -116,7 +126,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,12 +135,17 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -151,7 +166,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -161,12 +176,17 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -196,7 +216,7 @@ def build_list_by_resource_group_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +225,7 @@ def build_list_by_resource_group_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -236,7 +256,7 @@ def build_list_by_subscription_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +264,7 @@ def build_list_by_subscription_request( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -288,7 +308,6 @@ def get(self, resource_group_name: str, application_group_name: str, **kwargs: A :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -307,21 +326,20 @@ def get(self, resource_group_name: str, application_group_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -333,13 +351,9 @@ def get(self, resource_group_name: str, application_group_name: str, **kwargs: A deserialized = self._deserialize("ApplicationGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -363,7 +377,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -374,7 +387,7 @@ def create_or_update( self, resource_group_name: str, application_group_name: str, - application_group: IO, + application_group: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -387,11 +400,10 @@ def create_or_update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Required. - :type application_group: IO + :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -402,7 +414,7 @@ def create_or_update( self, resource_group_name: str, application_group_name: str, - application_group: Union[_models.ApplicationGroup, IO], + application_group: Union[_models.ApplicationGroup, IO[bytes]], **kwargs: Any ) -> _models.ApplicationGroup: """Create or update an applicationGroup. @@ -413,12 +425,8 @@ def create_or_update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Is either a - ApplicationGroup type or a IO type. Required. - :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ApplicationGroup type or a IO[bytes] type. Required. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup or IO[bytes] :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -446,7 +454,7 @@ def create_or_update( else: _json = self._serialize.body(application_group, "ApplicationGroup") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -454,16 +462,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,10 +490,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, **kwargs: Any @@ -498,7 +501,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -517,21 +519,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -541,11 +542,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -570,7 +567,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -581,7 +577,7 @@ def update( self, resource_group_name: str, application_group_name: str, - application_group: Optional[IO] = None, + application_group: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -595,11 +591,10 @@ def update( :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Default value is None. - :type application_group: IO + :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -610,7 +605,7 @@ def update( self, resource_group_name: str, application_group_name: str, - application_group: Optional[Union[_models.ApplicationGroupPatch, IO]] = None, + application_group: Optional[Union[_models.ApplicationGroupPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ApplicationGroup: """Update an applicationGroup. @@ -621,12 +616,9 @@ def update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Is either a - ApplicationGroupPatch type or a IO type. Default value is None. - :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ApplicationGroupPatch type or a IO[bytes] type. Default value is None. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch or + IO[bytes] :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -657,7 +649,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -665,16 +657,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -686,13 +677,9 @@ def update( deserialized = self._deserialize("ApplicationGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -718,7 +705,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -740,7 +726,7 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, filter=filter, @@ -748,12 +734,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -765,13 +750,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationGroupList", pipeline_response) @@ -781,11 +766,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,10 +782,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups" - } - @distributed_trace def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ApplicationGroup"]: """List applicationGroups in subscription. @@ -808,7 +789,6 @@ def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> I :param filter: OData filter expression. Valid properties for filtering are applicationGroupType. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -830,16 +810,15 @@ def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> I def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -851,13 +830,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationGroupList", pipeline_response) @@ -867,11 +846,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -882,7 +861,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py index 53337c7d544a..078419e538f9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,14 +52,21 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "applicationName": _SERIALIZER.url( + "application_name", application_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "applicationName": _SERIALIZER.url("application_name", application_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -79,7 +86,7 @@ def build_create_or_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,14 +96,21 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "applicationName": _SERIALIZER.url( + "application_name", application_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "applicationName": _SERIALIZER.url("application_name", application_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -118,7 +132,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,14 +141,21 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "applicationName": _SERIALIZER.url( + "application_name", application_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "applicationName": _SERIALIZER.url("application_name", application_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -154,7 +175,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -164,14 +185,21 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "applicationName": _SERIALIZER.url( + "application_name", application_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "applicationName": _SERIALIZER.url("application_name", application_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -200,7 +228,7 @@ def build_list_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,12 +237,17 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -268,7 +301,6 @@ def get( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -287,22 +319,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,13 +345,9 @@ def get( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -348,7 +375,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -360,7 +386,7 @@ def create_or_update( resource_group_name: str, application_group_name: str, application_name: str, - application: IO, + application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -376,11 +402,10 @@ def create_or_update( Required. :type application_name: str :param application: Object containing Application definitions. Required. - :type application: IO + :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -392,7 +417,7 @@ def create_or_update( resource_group_name: str, application_group_name: str, application_name: str, - application: Union[_models.Application, IO], + application: Union[_models.Application, IO[bytes]], **kwargs: Any ) -> _models.Application: """Create or update an application. @@ -406,12 +431,8 @@ def create_or_update( Required. :type application_name: str :param application: Object containing Application definitions. Is either a Application type or - a IO type. Required. - :type application: ~azure.mgmt.desktopvirtualization.models.Application or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + a IO[bytes] type. Required. + :type application: ~azure.mgmt.desktopvirtualization.models.Application or IO[bytes] :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -439,7 +460,7 @@ def create_or_update( else: _json = self._serialize.body(application, "Application") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, @@ -448,16 +469,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -477,10 +497,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, application_name: str, **kwargs: Any @@ -495,7 +511,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -514,22 +529,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,11 +553,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -571,7 +581,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -583,7 +592,7 @@ def update( resource_group_name: str, application_group_name: str, application_name: str, - application: Optional[IO] = None, + application: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -599,11 +608,10 @@ def update( Required. :type application_name: str :param application: Object containing Application definitions. Default value is None. - :type application: IO + :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -615,7 +623,7 @@ def update( resource_group_name: str, application_group_name: str, application_name: str, - application: Optional[Union[_models.ApplicationPatch, IO]] = None, + application: Optional[Union[_models.ApplicationPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Application: """Update an application. @@ -629,12 +637,8 @@ def update( Required. :type application_name: str :param application: Object containing Application definitions. Is either a ApplicationPatch - type or a IO type. Default value is None. - :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Default value is None. + :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch or IO[bytes] :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -665,7 +669,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, @@ -674,16 +678,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,13 +698,9 @@ def update( deserialized = self._deserialize("Application", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -726,7 +725,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Application or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Application] :raises ~azure.core.exceptions.HttpResponseError: @@ -748,7 +746,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -756,12 +754,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -773,13 +770,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationList", pipeline_response) @@ -789,11 +786,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -804,7 +801,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py index 6da4588b4dc1..4e1e214dc5aa 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,14 +52,21 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "desktopName": _SERIALIZER.url( + "desktop_name", desktop_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "desktopName": _SERIALIZER.url("desktop_name", desktop_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -79,7 +86,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,14 +96,21 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "desktopName": _SERIALIZER.url( + "desktop_name", desktop_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "desktopName": _SERIALIZER.url("desktop_name", desktop_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -125,7 +139,7 @@ def build_list_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,12 +148,17 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -192,7 +211,6 @@ def get( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -211,22 +229,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Desktop] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, desktop_name=desktop_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -238,13 +255,9 @@ def get( deserialized = self._deserialize("Desktop", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}" - } + return deserialized # type: ignore @overload def update( @@ -271,7 +284,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -283,7 +295,7 @@ def update( resource_group_name: str, application_group_name: str, desktop_name: str, - desktop: Optional[IO] = None, + desktop: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -298,11 +310,10 @@ def update( :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str :param desktop: Object containing Desktop definitions. Default value is None. - :type desktop: IO + :type desktop: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -314,7 +325,7 @@ def update( resource_group_name: str, application_group_name: str, desktop_name: str, - desktop: Optional[Union[_models.DesktopPatch, IO]] = None, + desktop: Optional[Union[_models.DesktopPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Desktop: """Update a desktop. @@ -326,13 +337,9 @@ def update( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str - :param desktop: Object containing Desktop definitions. Is either a DesktopPatch type or a IO - type. Default value is None. - :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param desktop: Object containing Desktop definitions. Is either a DesktopPatch type or a + IO[bytes] type. Default value is None. + :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch or IO[bytes] :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -363,7 +370,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, desktop_name=desktop_name, @@ -372,16 +379,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -393,13 +399,9 @@ def update( deserialized = self._deserialize("Desktop", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -424,7 +426,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Desktop or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Desktop] :raises ~azure.core.exceptions.HttpResponseError: @@ -446,7 +447,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -454,12 +455,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -471,13 +471,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DesktopList", pipeline_response) @@ -487,11 +487,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -502,7 +502,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py index a9a810f4e963..d412e5a3958a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +52,13 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -76,7 +78,7 @@ def build_create_or_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,11 +88,13 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -112,7 +116,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,11 +125,13 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -147,7 +153,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -157,11 +163,13 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -189,7 +197,7 @@ def build_list_by_resource_group_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +206,7 @@ def build_list_by_resource_group_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -232,7 +240,7 @@ def build_list_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +248,7 @@ def build_list_request( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -260,13 +268,13 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_retrieve_registration_token_request( +def build_retrieve_registration_token_request( # pylint: disable=name-too-long resource_group_name: str, host_pool_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -275,11 +283,13 @@ def build_retrieve_registration_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -321,7 +331,6 @@ def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _ :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -340,21 +349,20 @@ def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostPool] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -366,13 +374,9 @@ def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _ deserialized = self._deserialize("HostPool", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -396,7 +400,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -407,7 +410,7 @@ def create_or_update( self, resource_group_name: str, host_pool_name: str, - host_pool: IO, + host_pool: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -420,11 +423,10 @@ def create_or_update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Required. - :type host_pool: IO + :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -432,7 +434,11 @@ def create_or_update( @distributed_trace def create_or_update( - self, resource_group_name: str, host_pool_name: str, host_pool: Union[_models.HostPool, IO], **kwargs: Any + self, + resource_group_name: str, + host_pool_name: str, + host_pool: Union[_models.HostPool, IO[bytes]], + **kwargs: Any ) -> _models.HostPool: """Create or update a host pool. @@ -441,13 +447,9 @@ def create_or_update( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :param host_pool: Object containing HostPool definitions. Is either a HostPool type or a IO - type. Required. - :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param host_pool: Object containing HostPool definitions. Is either a HostPool type or a + IO[bytes] type. Required. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool or IO[bytes] :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -475,7 +477,7 @@ def create_or_update( else: _json = self._serialize.body(host_pool, "HostPool") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -483,16 +485,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,10 +513,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, force: Optional[bool] = None, **kwargs: Any @@ -529,7 +526,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type host_pool_name: str :param force: Force flag to delete sessionHost. Default value is None. :type force: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -548,22 +544,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, force=force, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,11 +568,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -601,7 +592,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -612,7 +602,7 @@ def update( self, resource_group_name: str, host_pool_name: str, - host_pool: Optional[IO] = None, + host_pool: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -625,11 +615,10 @@ def update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Default value is None. - :type host_pool: IO + :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -640,7 +629,7 @@ def update( self, resource_group_name: str, host_pool_name: str, - host_pool: Optional[Union[_models.HostPoolPatch, IO]] = None, + host_pool: Optional[Union[_models.HostPoolPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.HostPool: """Update a host pool. @@ -651,12 +640,8 @@ def update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Is either a HostPoolPatch type or a - IO type. Default value is None. - :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Default value is None. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch or IO[bytes] :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -687,7 +672,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -695,16 +680,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -716,13 +700,9 @@ def update( deserialized = self._deserialize("HostPool", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -744,7 +724,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPool or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.HostPool] :raises ~azure.core.exceptions.HttpResponseError: @@ -766,19 +745,18 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -790,13 +768,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("HostPoolList", pipeline_response) @@ -806,11 +784,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -822,10 +800,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools" - } - @distributed_trace def list( self, @@ -842,7 +816,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPool or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.HostPool] :raises ~azure.core.exceptions.HttpResponseError: @@ -864,18 +837,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -887,13 +859,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("HostPoolList", pipeline_response) @@ -903,11 +875,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -919,8 +891,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools"} - @distributed_trace def retrieve_registration_token( self, resource_group_name: str, host_pool_name: str, **kwargs: Any @@ -932,7 +902,6 @@ def retrieve_registration_token( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistrationInfo or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :raises ~azure.core.exceptions.HttpResponseError: @@ -951,21 +920,20 @@ def retrieve_registration_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RegistrationInfo] = kwargs.pop("cls", None) - request = build_retrieve_registration_token_request( + _request = build_retrieve_registration_token_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve_registration_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -977,10 +945,6 @@ def retrieve_registration_token( deserialized = self._deserialize("RegistrationInfo", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - retrieve_registration_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken" - } + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py index 452128147281..d108008c3440 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_expand_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53,11 +53,13 @@ def build_expand_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -114,7 +116,6 @@ def expand( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] :raises ~azure.core.exceptions.HttpResponseError: @@ -125,7 +126,7 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: IO, + msix_image_uri: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -138,11 +139,10 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. Required. - :type msix_image_uri: IO + :type msix_image_uri: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] :raises ~azure.core.exceptions.HttpResponseError: @@ -153,7 +153,7 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: Union[_models.MSIXImageURI, IO], + msix_image_uri: Union[_models.MSIXImageURI, IO[bytes]], **kwargs: Any ) -> Iterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. @@ -164,12 +164,8 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. Is either a MSIXImageURI type or a - IO type. Required. - :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI or IO[bytes] :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] :raises ~azure.core.exceptions.HttpResponseError: @@ -199,7 +195,7 @@ def expand( def prepare_request(next_link=None): if not next_link: - request = build_expand_request( + _request = build_expand_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -207,12 +203,11 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.expand.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -224,13 +219,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ExpandMsixImageList", pipeline_response) @@ -240,11 +235,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,7 +250,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - expand.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py index 3ad5108dc6ec..89c66bb0445c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,13 +52,20 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "msixPackageFullName": _SERIALIZER.url( - "msix_package_full_name", msix_package_full_name, "str", max_length=100, min_length=3 + "msix_package_full_name", + msix_package_full_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -79,7 +86,7 @@ def build_create_or_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,13 +96,20 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "msixPackageFullName": _SERIALIZER.url( - "msix_package_full_name", msix_package_full_name, "str", max_length=100, min_length=3 + "msix_package_full_name", + msix_package_full_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -118,7 +132,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,13 +141,20 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "msixPackageFullName": _SERIALIZER.url( - "msix_package_full_name", msix_package_full_name, "str", max_length=100, min_length=3 + "msix_package_full_name", + msix_package_full_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -154,7 +175,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -164,13 +185,20 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "msixPackageFullName": _SERIALIZER.url( - "msix_package_full_name", msix_package_full_name, "str", max_length=100, min_length=3 + "msix_package_full_name", + msix_package_full_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -200,7 +228,7 @@ def build_list_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,11 +237,13 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -266,7 +296,6 @@ def get( :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. Required. :type msix_package_full_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -285,22 +314,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MSIXPackage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -312,13 +340,9 @@ def get( deserialized = self._deserialize("MSIXPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -346,7 +370,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +381,7 @@ def create_or_update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: IO, + msix_package: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -374,11 +397,10 @@ def create_or_update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Required. - :type msix_package: IO + :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -390,7 +412,7 @@ def create_or_update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Union[_models.MSIXPackage, IO], + msix_package: Union[_models.MSIXPackage, IO[bytes]], **kwargs: Any ) -> _models.MSIXPackage: """Create or update a MSIX package. @@ -404,12 +426,8 @@ def create_or_update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackage type - or a IO type. Required. - :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage or IO[bytes] :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -437,7 +455,7 @@ def create_or_update( else: _json = self._serialize.body(msix_package, "MSIXPackage") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, @@ -446,16 +464,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -475,10 +492,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, **kwargs: Any @@ -493,7 +506,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. Required. :type msix_package_full_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -512,22 +524,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,11 +548,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -569,7 +576,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -581,7 +587,7 @@ def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[IO] = None, + msix_package: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -597,11 +603,10 @@ def update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Default value is None. - :type msix_package: IO + :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -613,7 +618,7 @@ def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[Union[_models.MSIXPackagePatch, IO]] = None, + msix_package: Optional[Union[_models.MSIXPackagePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.MSIXPackage: """Update an MSIX Package. @@ -627,12 +632,8 @@ def update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackagePatch - type or a IO type. Default value is None. - :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Default value is None. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch or IO[bytes] :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -663,7 +664,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, @@ -672,16 +673,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -693,13 +693,9 @@ def update( deserialized = self._deserialize("MSIXPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -724,7 +720,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MSIXPackage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.MSIXPackage] :raises ~azure.core.exceptions.HttpResponseError: @@ -746,7 +741,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -754,12 +749,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -771,13 +765,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("MSIXPackageList", pipeline_response) @@ -787,11 +781,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -802,7 +796,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py index daa03136702e..8d7737c3aa12 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,7 +40,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: """List all of the available operations the Desktop Virtualization resource provider supports. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceProviderOperation or the result of cls(response) :rtype: @@ -102,14 +101,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -121,13 +119,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) @@ -137,11 +135,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,5 +150,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.DesktopVirtualization/operations"} diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py index b6462f385c36..b3b1a3b45458 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_list_by_workspace_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +52,13 @@ def build_list_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -80,7 +82,7 @@ def build_get_by_workspace_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,11 +91,13 @@ def build_get_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -120,7 +124,7 @@ def build_delete_by_workspace_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,11 +133,13 @@ def build_delete_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -160,7 +166,7 @@ def build_update_by_workspace_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,11 +176,13 @@ def build_update_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -206,7 +214,7 @@ def build_list_by_host_pool_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -215,11 +223,13 @@ def build_list_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -249,7 +259,7 @@ def build_get_by_host_pool_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -258,11 +268,13 @@ def build_get_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -289,7 +301,7 @@ def build_delete_by_host_pool_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -298,11 +310,13 @@ def build_delete_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -329,7 +343,7 @@ def build_update_by_host_pool_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -339,11 +353,13 @@ def build_update_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -392,7 +408,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -416,17 +431,16 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -438,13 +452,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) @@ -454,11 +468,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,10 +484,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections" - } - @distributed_trace def get_by_workspace( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -488,7 +498,6 @@ def get_by_workspace( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -507,22 +516,21 @@ def get_by_workspace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionWithSystemData] = kwargs.pop("cls", None) - request = build_get_by_workspace_request( + _request = build_get_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,13 +542,9 @@ def get_by_workspace( deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def delete_by_workspace( # pylint: disable=inconsistent-return-statements @@ -556,7 +560,6 @@ def delete_by_workspace( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -575,22 +578,21 @@ def delete_by_workspace( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_by_workspace_request( + _request = build_delete_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -600,11 +602,7 @@ def delete_by_workspace( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update_by_workspace( @@ -632,7 +630,6 @@ def update_by_workspace( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -644,7 +641,7 @@ def update_by_workspace( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - connection: IO, + connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -660,11 +657,10 @@ def update_by_workspace( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Required. - :type connection: IO + :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -676,7 +672,7 @@ def update_by_workspace( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO], + connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: """Approve or reject a private endpoint connection. @@ -690,12 +686,9 @@ def update_by_workspace( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or + IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -723,7 +716,7 @@ def update_by_workspace( else: _json = self._serialize.body(connection, "PrivateEndpointConnection") - request = build_update_by_workspace_request( + _request = build_update_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -732,16 +725,15 @@ def update_by_workspace( content_type=content_type, json=_json, content=_content, - template_url=self.update_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -753,13 +745,9 @@ def update_by_workspace( deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def list_by_host_pool( @@ -784,7 +772,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -808,7 +795,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -816,12 +803,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -833,13 +819,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) @@ -849,11 +835,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -865,10 +851,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections" - } - @distributed_trace def get_by_host_pool( self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -883,7 +865,6 @@ def get_by_host_pool( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -902,22 +883,21 @@ def get_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionWithSystemData] = kwargs.pop("cls", None) - request = build_get_by_host_pool_request( + _request = build_get_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -929,13 +909,9 @@ def get_by_host_pool( deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def delete_by_host_pool( # pylint: disable=inconsistent-return-statements @@ -951,7 +927,6 @@ def delete_by_host_pool( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -970,22 +945,21 @@ def delete_by_host_pool( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_by_host_pool_request( + _request = build_delete_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -995,11 +969,7 @@ def delete_by_host_pool( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update_by_host_pool( @@ -1027,7 +997,6 @@ def update_by_host_pool( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -1039,7 +1008,7 @@ def update_by_host_pool( resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, - connection: IO, + connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1055,11 +1024,10 @@ def update_by_host_pool( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Required. - :type connection: IO + :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -1071,7 +1039,7 @@ def update_by_host_pool( resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO], + connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: """Approve or reject a private endpoint connection. @@ -1085,12 +1053,9 @@ def update_by_host_pool( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or + IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -1118,7 +1083,7 @@ def update_by_host_pool( else: _json = self._serialize.body(connection, "PrivateEndpointConnection") - request = build_update_by_host_pool_request( + _request = build_update_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -1127,16 +1092,15 @@ def update_by_host_pool( content_type=content_type, json=_json, content=_content, - template_url=self.update_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1148,10 +1112,6 @@ def update_by_host_pool( deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py index 7bbc918fb94c..b9e5c59eaf8e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -49,7 +49,7 @@ def build_list_by_workspace_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,11 +58,13 @@ def build_list_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -95,7 +97,7 @@ def build_list_by_host_pool_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,11 +106,13 @@ def build_list_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -170,7 +174,6 @@ def list_by_workspace( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] @@ -193,7 +196,7 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -201,12 +204,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -218,13 +220,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -234,11 +236,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,10 +252,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources" - } - @distributed_trace def list_by_host_pool( self, @@ -277,7 +275,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] @@ -300,7 +297,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -308,12 +305,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -325,13 +321,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -341,11 +337,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -356,7 +352,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py index d4d7d34d218c..ec85e70c7671 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -47,7 +47,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,13 +56,20 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -87,7 +94,7 @@ def build_create_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97,13 +104,20 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -130,7 +144,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,13 +153,20 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -170,7 +191,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,13 +201,20 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -216,7 +244,7 @@ def build_list_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,11 +253,13 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -281,7 +311,6 @@ def get( :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -300,22 +329,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPersonalSchedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -327,13 +355,9 @@ def get( deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @overload def create( @@ -362,7 +386,6 @@ def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -374,7 +397,7 @@ def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: IO, + scaling_plan_schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -390,11 +413,10 @@ def create( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Required. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -406,7 +428,7 @@ def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Union[_models.ScalingPlanPersonalSchedule, IO], + scaling_plan_schedule: Union[_models.ScalingPlanPersonalSchedule, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Create or update a ScalingPlanPersonalSchedule. @@ -419,13 +441,9 @@ def create( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Is - either a ScalingPlanPersonalSchedule type or a IO type. Required. + either a ScalingPlanPersonalSchedule type or a IO[bytes] type. Required. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule or IO[bytes] :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -453,7 +471,7 @@ def create( else: _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPersonalSchedule") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -462,16 +480,15 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -491,10 +508,6 @@ def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -508,7 +521,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -527,22 +539,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,11 +563,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -585,7 +592,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -597,7 +603,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO] = None, + scaling_plan_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -613,11 +619,10 @@ def update( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Default value is None. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -629,7 +634,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO]] = None, + scaling_plan_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Update a ScalingPlanPersonalSchedule. @@ -642,13 +647,9 @@ def update( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Is - either a ScalingPlanPersonalSchedulePatch type or a IO type. Default value is None. + either a ScalingPlanPersonalSchedulePatch type or a IO[bytes] type. Default value is None. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch or IO[bytes] :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -679,7 +680,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -688,16 +689,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -709,13 +709,9 @@ def update( deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -740,7 +736,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanPersonalSchedule or the result of cls(response) :rtype: @@ -764,7 +759,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -772,12 +767,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -789,13 +783,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanPersonalScheduleList", pipeline_response) @@ -805,11 +799,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -820,7 +814,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py index f735b49cea2f..a01b9c2a6169 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -47,7 +47,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,13 +56,20 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -87,7 +94,7 @@ def build_create_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97,13 +104,20 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -130,7 +144,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,13 +153,20 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -170,7 +191,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,13 +201,20 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -216,7 +244,7 @@ def build_list_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,11 +253,13 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -281,7 +311,6 @@ def get( :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -300,22 +329,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPooledSchedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -327,13 +355,9 @@ def get( deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @overload def create( @@ -361,7 +385,6 @@ def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -373,7 +396,7 @@ def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: IO, + scaling_plan_schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -389,11 +412,10 @@ def create( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Required. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -405,7 +427,7 @@ def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Union[_models.ScalingPlanPooledSchedule, IO], + scaling_plan_schedule: Union[_models.ScalingPlanPooledSchedule, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Create or update a ScalingPlanPooledSchedule. @@ -418,13 +440,9 @@ def create( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Is - either a ScalingPlanPooledSchedule type or a IO type. Required. + either a ScalingPlanPooledSchedule type or a IO[bytes] type. Required. :type scaling_plan_schedule: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or IO[bytes] :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -452,7 +470,7 @@ def create( else: _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPooledSchedule") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -461,16 +479,15 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -490,10 +507,6 @@ def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -507,7 +520,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -526,22 +538,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -551,11 +562,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -584,7 +591,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -596,7 +602,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO] = None, + scaling_plan_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -612,11 +618,10 @@ def update( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Default value is None. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -628,7 +633,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO]] = None, + scaling_plan_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Update a ScalingPlanPooledSchedule. @@ -641,13 +646,9 @@ def update( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Is - either a ScalingPlanPooledSchedulePatch type or a IO type. Default value is None. + either a ScalingPlanPooledSchedulePatch type or a IO[bytes] type. Default value is None. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch or IO[bytes] :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -678,7 +679,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -687,16 +688,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -708,13 +708,9 @@ def update( deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -739,7 +735,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanPooledSchedule or the result of cls(response) :rtype: @@ -763,7 +758,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -771,12 +766,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -788,13 +782,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanPooledScheduleList", pipeline_response) @@ -804,11 +798,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -819,7 +813,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py index ae34ecab6c2f..c979cc05823e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +52,13 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -76,7 +78,7 @@ def build_create_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,11 +88,13 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -112,7 +116,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,11 +125,13 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -145,7 +151,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,11 +161,13 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -187,7 +195,7 @@ def build_list_by_resource_group_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +204,7 @@ def build_list_by_resource_group_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -230,7 +238,7 @@ def build_list_by_subscription_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +246,7 @@ def build_list_by_subscription_request( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -271,7 +279,7 @@ def build_list_by_host_pool_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -280,11 +288,13 @@ def build_list_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -332,7 +342,6 @@ def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) - :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -351,21 +360,20 @@ def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlan] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,13 +385,9 @@ def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) - deserialized = self._deserialize("ScalingPlan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return deserialized # type: ignore @overload def create( @@ -407,7 +411,6 @@ def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -418,7 +421,7 @@ def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: IO, + scaling_plan: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -431,11 +434,10 @@ def create( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Required. - :type scaling_plan: IO + :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -446,7 +448,7 @@ def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Union[_models.ScalingPlan, IO], + scaling_plan: Union[_models.ScalingPlan, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlan: """Create or update a scaling plan. @@ -457,12 +459,8 @@ def create( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Is either a ScalingPlan type - or a IO type. Required. - :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan or IO[bytes] :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -490,7 +488,7 @@ def create( else: _json = self._serialize.body(scaling_plan, "ScalingPlan") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -498,16 +496,15 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -527,10 +524,6 @@ def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any @@ -542,7 +535,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -561,21 +553,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,11 +576,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -613,7 +600,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -624,7 +610,7 @@ def update( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[IO] = None, + scaling_plan: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -637,11 +623,10 @@ def update( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Default value is None. - :type scaling_plan: IO + :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -652,7 +637,7 @@ def update( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO]] = None, + scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlan: """Update a scaling plan. @@ -663,12 +648,8 @@ def update( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Is either a ScalingPlanPatch - type or a IO type. Default value is None. - :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Default value is None. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch or IO[bytes] :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -699,7 +680,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -707,16 +688,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -728,13 +708,9 @@ def update( deserialized = self._deserialize("ScalingPlan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -756,7 +732,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] :raises ~azure.core.exceptions.HttpResponseError: @@ -778,19 +753,18 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -802,13 +776,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -818,11 +792,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -834,10 +808,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans" - } - @distributed_trace def list_by_subscription( self, @@ -854,7 +824,6 @@ def list_by_subscription( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] :raises ~azure.core.exceptions.HttpResponseError: @@ -876,18 +845,17 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -899,13 +867,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -915,11 +883,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -931,10 +899,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans" - } - @distributed_trace def list_by_host_pool( self, @@ -958,7 +922,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] :raises ~azure.core.exceptions.HttpResponseError: @@ -980,7 +943,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -988,12 +951,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1005,13 +967,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -1021,11 +983,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,7 +998,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py index 231e01d95a33..ceb9c17c976c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,12 +52,16 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -83,7 +87,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,12 +96,16 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -125,7 +133,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,12 +143,16 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -171,7 +183,7 @@ def build_list_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,11 +192,13 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -237,7 +251,6 @@ def get( :param session_host_name: The name of the session host within the specified host pool. Required. :type session_host_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -256,22 +269,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SessionHost] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -283,13 +295,9 @@ def get( deserialized = self._deserialize("SessionHost", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -313,7 +321,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param force: Force flag to force sessionHost deletion even when userSession exists. Default value is None. :type force: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -332,23 +339,22 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, subscription_id=self._config.subscription_id, force=force, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,11 +364,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -394,7 +396,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -407,7 +408,7 @@ def update( host_pool_name: str, session_host_name: str, force: Optional[bool] = None, - session_host: Optional[IO] = None, + session_host: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -426,11 +427,10 @@ def update( is None. :type force: bool :param session_host: Object containing SessionHost definitions. Default value is None. - :type session_host: IO + :type session_host: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -443,7 +443,7 @@ def update( host_pool_name: str, session_host_name: str, force: Optional[bool] = None, - session_host: Optional[Union[_models.SessionHostPatch, IO]] = None, + session_host: Optional[Union[_models.SessionHostPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.SessionHost: """Update a session host. @@ -460,12 +460,8 @@ def update( is None. :type force: bool :param session_host: Object containing SessionHost definitions. Is either a SessionHostPatch - type or a IO type. Default value is None. - :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Default value is None. + :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch or IO[bytes] :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -496,7 +492,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -506,16 +502,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -527,13 +522,9 @@ def update( deserialized = self._deserialize("SessionHost", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -558,7 +549,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SessionHost or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHost] :raises ~azure.core.exceptions.HttpResponseError: @@ -580,7 +570,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -588,12 +578,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -605,13 +594,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SessionHostList", pipeline_response) @@ -621,11 +610,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -636,7 +625,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py index a17065ac2cdc..abc4c478fdb0 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -49,7 +49,7 @@ def build_list_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,12 +58,17 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -126,7 +131,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StartMenuItem or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.StartMenuItem] :raises ~azure.core.exceptions.HttpResponseError: @@ -148,7 +152,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -156,12 +160,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -173,13 +176,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("StartMenuItemList", pipeline_response) @@ -189,11 +192,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -204,7 +207,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py index ba3683afd05d..b51d12f4a7f9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -51,7 +51,7 @@ def build_list_by_host_pool_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,11 +60,13 @@ def build_list_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -97,7 +99,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,12 +108,16 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, "str", max_length=24, min_length=1), } @@ -139,7 +145,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,12 +154,16 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, "str", max_length=24, min_length=1), } @@ -184,7 +194,7 @@ def build_list_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -193,12 +203,16 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -229,7 +243,7 @@ def build_disconnect_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,12 +252,16 @@ def build_disconnect_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, "str", max_length=24, min_length=1), } @@ -269,7 +287,7 @@ def build_send_message_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -279,12 +297,16 @@ def build_send_message_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, "str", max_length=24, min_length=1), } @@ -347,7 +369,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSession or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.UserSession] :raises ~azure.core.exceptions.HttpResponseError: @@ -369,7 +390,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -378,12 +399,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -395,13 +415,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("UserSessionList", pipeline_response) @@ -411,11 +431,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,10 +447,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions" - } - @distributed_trace def get( self, resource_group_name: str, host_pool_name: str, session_host_name: str, user_session_id: str, **kwargs: Any @@ -448,7 +464,6 @@ def get( :param user_session_id: The name of the user session within the specified session host. Required. :type user_session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSession or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.UserSession :raises ~azure.core.exceptions.HttpResponseError: @@ -467,23 +482,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserSession] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, user_session_id=user_session_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -495,13 +509,9 @@ def get( deserialized = self._deserialize("UserSession", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -528,7 +538,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type user_session_id: str :param force: Force flag to login off userSession. Default value is None. :type force: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -547,7 +556,7 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -555,16 +564,15 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, force=force, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,11 +582,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list( @@ -607,7 +611,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSession or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.UserSession] :raises ~azure.core.exceptions.HttpResponseError: @@ -629,7 +632,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -638,12 +641,11 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -655,13 +657,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("UserSessionList", pipeline_response) @@ -671,11 +673,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -687,10 +689,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions" - } - @distributed_trace def disconnect( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, session_host_name: str, user_session_id: str, **kwargs: Any @@ -708,7 +706,6 @@ def disconnect( # pylint: disable=inconsistent-return-statements :param user_session_id: The name of the user session within the specified session host. Required. :type user_session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -727,23 +724,22 @@ def disconnect( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_disconnect_request( + _request = build_disconnect_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, user_session_id=user_session_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.disconnect.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -753,11 +749,7 @@ def disconnect( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - disconnect.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def send_message( # pylint: disable=inconsistent-return-statements @@ -790,7 +782,6 @@ def send_message( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -803,7 +794,7 @@ def send_message( # pylint: disable=inconsistent-return-statements host_pool_name: str, session_host_name: str, user_session_id: str, - send_message: Optional[IO] = None, + send_message: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -823,11 +814,10 @@ def send_message( # pylint: disable=inconsistent-return-statements :type user_session_id: str :param send_message: Object containing message includes title and message body. Default value is None. - :type send_message: IO + :type send_message: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -840,7 +830,7 @@ def send_message( # pylint: disable=inconsistent-return-statements host_pool_name: str, session_host_name: str, user_session_id: str, - send_message: Optional[Union[_models.SendMessage, IO]] = None, + send_message: Optional[Union[_models.SendMessage, IO[bytes]]] = None, **kwargs: Any ) -> None: """Send a message to a user. @@ -857,12 +847,8 @@ def send_message( # pylint: disable=inconsistent-return-statements Required. :type user_session_id: str :param send_message: Object containing message includes title and message body. Is either a - SendMessage type or a IO type. Default value is None. - :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + SendMessage type or a IO[bytes] type. Default value is None. + :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -893,7 +879,7 @@ def send_message( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_send_message_request( + _request = build_send_message_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -903,16 +889,15 @@ def send_message( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.send_message.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -922,8 +907,4 @@ def send_message( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - send_message.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py index 8419c3184b09..4d41a811d248 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +52,13 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -76,7 +78,7 @@ def build_create_or_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,11 +88,13 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -112,7 +116,7 @@ def build_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,11 +125,13 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -145,7 +151,7 @@ def build_update_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,11 +161,13 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -187,7 +195,7 @@ def build_list_by_resource_group_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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +204,7 @@ def build_list_by_resource_group_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -223,7 +231,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _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", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +239,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -273,7 +281,6 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -292,21 +299,20 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,13 +324,9 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -348,7 +350,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -359,7 +360,7 @@ def create_or_update( self, resource_group_name: str, workspace_name: str, - workspace: IO, + workspace: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -372,11 +373,10 @@ def create_or_update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Required. - :type workspace: IO + :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -384,7 +384,11 @@ def create_or_update( @distributed_trace def create_or_update( - self, resource_group_name: str, workspace_name: str, workspace: Union[_models.Workspace, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + workspace: Union[_models.Workspace, IO[bytes]], + **kwargs: Any ) -> _models.Workspace: """Create or update a workspace. @@ -393,13 +397,9 @@ def create_or_update( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :param workspace: Object containing Workspace definitions. Is either a Workspace type or a IO - type. Required. - :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param workspace: Object containing Workspace definitions. Is either a Workspace type or a + IO[bytes] type. Required. + :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace or IO[bytes] :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -427,7 +427,7 @@ def create_or_update( else: _json = self._serialize.body(workspace, "Workspace") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -435,16 +435,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -464,10 +463,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, **kwargs: Any @@ -479,7 +474,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -498,21 +492,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -522,11 +515,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -550,7 +539,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -561,7 +549,7 @@ def update( self, resource_group_name: str, workspace_name: str, - workspace: Optional[IO] = None, + workspace: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -574,11 +562,10 @@ def update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Default value is None. - :type workspace: IO + :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -589,7 +576,7 @@ def update( self, resource_group_name: str, workspace_name: str, - workspace: Optional[Union[_models.WorkspacePatch, IO]] = None, + workspace: Optional[Union[_models.WorkspacePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Workspace: """Update a workspace. @@ -600,12 +587,8 @@ def update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Is either a WorkspacePatch type or a - IO type. Default value is None. - :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Default value is None. + :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch or IO[bytes] :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -636,7 +619,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -644,16 +627,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -665,13 +647,9 @@ def update( deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -693,7 +671,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -715,19 +692,18 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -739,13 +715,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceList", pipeline_response) @@ -755,11 +731,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -771,15 +747,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces" - } - @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: """List workspaces in subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -801,15 +772,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -821,13 +791,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceList", pipeline_response) @@ -837,11 +807,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -852,7 +822,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py new file mode 100644 index 000000000000..d2b766db2bbd --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_create.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.create_or_update( + resource_group_name="resourceGroup1", + app_attach_package_name="msixpackagefullname", + app_attach_package={ + "location": "southcentralus", + "properties": { + "failHealthCheckOnStagingFailure": "NeedsAssistance", + "hostPoolReferences": [], + "image": { + "certificateExpiry": "2023-01-02T17:18:19.1234567Z", + "certificateName": "certName", + "displayName": "displayname", + "imagePath": "imagepath", + "isActive": False, + "isRegularRegistration": False, + "lastUpdated": "2008-09-22T14:01:54.9571247Z", + "packageAlias": "msixpackagealias", + "packageApplications": [ + { + "appId": "AppId", + "appUserModelID": "AppUserModelId", + "description": "PackageApplicationDescription", + "friendlyName": "FriendlyName", + "iconImageName": "Iconimagename", + "rawIcon": "VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo", + "rawPng": "VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo", + } + ], + "packageDependencies": [ + { + "dependencyName": "MsixPackage_Dependency_Name", + "minVersion": "packageDep_version", + "publisher": "MsixPackage_Dependency_Publisher", + } + ], + "packageFamilyName": "MsixPackage_FamilyName", + "packageFullName": "MsixPackage_FullName", + "packageName": "MsixPackageName", + "packageRelativePath": "packagerelativepath", + "version": "packageversion", + }, + "keyVaultURL": "", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py new file mode 100644 index 000000000000..dbae419122ab --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_delete.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.app_attach_package.delete( + resource_group_name="resourceGroup1", + app_attach_package_name="packagefullname", + ) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py new file mode 100644 index 000000000000..d3306b7757cc --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_get.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.get( + resource_group_name="resourceGroup1", + app_attach_package_name="packagefullname", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py new file mode 100644 index 000000000000..4560925f5d3b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_info_import_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package_info.import_method( + resource_group_name="resourceGroup1", + host_pool_name="hostpool1", + import_package_info_request={"packageArchitecture": "x64", "path": "imagepath"}, + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackageInfo_Import_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py new file mode 100644 index 000000000000..3bfdde166329 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_list_by_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.list_by_resource_group( + resource_group_name="resourceGroup1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py new file mode 100644 index 000000000000..fb648e62a071 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_list_by_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py new file mode 100644 index 000000000000..0b1239001f98 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_update.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.update( + resource_group_name="resourceGroup1", + app_attach_package_name="msixpackagefullname", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py index df2e652513a2..a9cffa4ede31 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -49,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py index a2e10c776409..849f2aadaafb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py index be2a3c46c31b..1ea6ce092768 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py index 080eea544cde..9392af7ef7f9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -47,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py index 918ac61d8d8a..22df1d08fa55 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py index d6e7f3238c77..25c26db4e667 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py index 9f8854070fbc..0f30342aa9f3 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py index 9c8e6f484815..514eaf021932 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py index ae3b69e90abc..a618dce1d629 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py index 2a069dded7b5..0c964e1fbb90 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py index 2543ab83cc46..1a5f906da636 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py index 6e434cde2579..18b47790ea7d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Desktop_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py index fbb4fc16947b..753ecea64156 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Desktop_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py index 58d8e8c495f6..b358a4f54be6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Desktop_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py index 7d583f1491dd..c3f426a74878 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -66,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py index 30ef526635f4..c35977b4394e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py index d774395db188..bfc0c17fe097 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py index b9c61d910d28..aa25e869679a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py index 5433bc9a1628..50c8e0015963 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py index f2f8ecad8fa9..df9f0ded78f4 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py index 82388e1af917..a46f233a7b41 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPools_RetrieveRegistrationToken_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPools_RetrieveRegistrationToken_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py index 4327c7d44dfe..333a54f99d2c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -38,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixImage_Expand_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixImage_Expand_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py index f2bdff869363..a162f1872344 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -68,6 +71,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py index ed4db6714575..35396a87ea47 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py index 4221df096b95..122d3ac8bc1a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py index 76512ce69a8f..bdf2b76e629d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py index a61bacfd4dc1..816aede3d0d0 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py index de7cd47c7ead..7ba9404dee7d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/OperationDescription_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/OperationDescription_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py index 347a812ff1f9..ee41840691d3 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_DeleteByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_DeleteByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py index f11494a4626e..15a006caf960 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_DeleteByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_DeleteByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py index 78c12ba812f5..f8660d4b0a81 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_GetByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py index f484da865a1b..f9b0589a2b64 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_GetByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py index 6bd2f22e9a6f..6d5201a27ce5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py index 23ff8d0eec94..6c41ad8e1512 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_ListByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_ListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py index 3be897a7f53c..1d4f5c3e62ec 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -46,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_UpdateByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py index f190b60b4aff..f852bfbcbd71 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -46,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_UpdateByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py index 29fc40869770..9374072152e6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateLinkResources_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateLinkResources_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py index a8834b07a4a9..da8ec5caceee 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateLinkResources_ListByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateLinkResources_ListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py index 5bd98f82ce20..48bdc2487ee0 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -74,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py index b94c9879a1cd..f627b071de76 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py index cdc193d77aa8..b40c90aa5902 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py index a4ccc4d2f3b1..c3635c78f0da 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py index 8bbc064b5d82..b92cc80c5a82 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py index 43d3223af985..b08092ed37bb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py index 7c475a40da18..d442971c0bfb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -67,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py index 0d51d4e338d9..77b4b85fa9a1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py index 3a35b69d163f..14d7e4d9b927 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py index b841cc3eb41b..a1f7eb130178 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py index 9d36ca179a39..ce57fd0e33db 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py index f87520f7b745..6dccf31a80c2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -57,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py index b95b9669dac9..f2d90dec35c5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py index f83d30ca7c76..da2a627f4692 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py index 41bb73ba98e6..82033bd51b3a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py index eed711a358f3..cf4ad0c45745 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py index 0b82204268e5..ec6e2d3e7eaf 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py index 946b4d9da293..37aaf96a7d31 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py index b1f7b32304e2..cd1a39e42ce4 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py index 16559e7d470b..59df6423ee56 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py index da99b9081f12..66a906828b50 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py index 58f79ef2c86e..3947795d4bc0 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/StartMenuItem_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/StartMenuItem_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py index 00ca1c1fc6d8..9795cd6b3ea7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py index fbe5371f406e..56a22a9a2d33 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_Disconnect_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Disconnect_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py index 469a091c203e..1c2dd0b04134 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py index 47507e0c5cbf..37e3dff31c75 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py index 4bbaf72a8502..7ece20e47752 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py index c3bbd4fc1b59..f3f3889c48e4 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_SendMessage_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_SendMessage_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py index cd9254a84892..bd972aa4f703 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -41,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py index 60a5346fd866..8c8f3f1bc584 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py index a2983f58eb4a..32696811908c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py index 3822f62ce5c9..c9341a79edc5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py index 6a1aa43a6869..c21d95f4c0ee 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py index e2ad9c4fac4c..ad8e24ed16eb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py index 2fa9a604d59d..dd851ac31293 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )